:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #10b981;
    --star-gold: #fbbf24;
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Background Animated Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: move 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #6366f1;
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: #a855f7;
    bottom: -150px;
    left: -150px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: #10b981;
    top: 40%;
    left: 20%;
    animation-delay: -10s;
}

@keyframes move {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(50px, 100px) scale(1.1); }
}

/* Header */
header {
    padding: 60px 0 40px;
    text-align: center;
}

.gradient-text {
    font-size: 3.5rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    padding-bottom: 60px;
    /* Use order for sorting */
}

.tool-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s ease, order 0.5s ease;
    display: flex;
    flex-direction: column;
}

.tool-card:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.4);
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    position: relative;
}

.tool-icon {
    font-size: 24px;
    background: rgba(99, 102, 241, 0.1);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.tool-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    flex: 1;
}

/* Star Button */
.btn-star {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    filter: grayscale(1);
    opacity: 0.5;
    transition: all 0.3s ease;
    padding: 5px;
}

.btn-star:hover {
    transform: scale(1.2);
    opacity: 1;
}

.tool-card.starred .btn-star {
    filter: grayscale(0);
    color: var(--star-gold);
    opacity: 1;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
}

.tool-card.starred {
    border-color: rgba(251, 191, 36, 0.3);
}

/* Form Elements */
.input-group, .checkbox-group, .input-row {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input[type="text"], 
input[type="number"], 
select, 
textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

textarea {
    height: 120px;
    resize: vertical;
}

.input-row {
    display: flex;
    gap: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 10px;
    color: var(--text-main);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
}

.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-sm:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

/* Result Area */
.result-area {
    margin-top: auto;
    padding-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#pwd-result, #unit-result {
    flex: 1;
    min-width: 200px;
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--accent);
    font-family: monospace;
    font-weight: 600;
}

.stats {
    margin-bottom: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Specific Tool Styles */
.qr-container {
    background: white;
    padding: 15px;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    margin: 10px 0 20px;
    min-height: 150px;
    align-items: center;
}

.color-preview {
    width: 100%;
    height: 80px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 15px;
}

.timer-display {
    font-size: 3.5rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    text-align: center;
    margin-bottom: 15px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ratio-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Language Switcher */
.lang-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    display: flex;
    gap: 4px;
    box-shadow: var(--shadow);
}

.btn-lang {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-lang:hover {
    color: var(--text-main);
}

.btn-lang.active {
    background: var(--primary);
    color: white;
}

/* Footer */
footer {
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--border);
    margin-top: 40px;
    color: var(--text-muted);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .gradient-text {
        font-size: 2.5rem;
    }
    .tools-grid {
        grid-template-columns: 1fr;
    }
    .lang-switcher {
        top: auto;
        bottom: 20px;
        right: 20px;
    }
}
