/* Apple-inspired Liquid Glass Effect CSS - Compact Version */
:root {
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 20px;
    --spacing-xl: 24px;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, #f5f7fa, #c3cfe2);
    background-size: 400% 400%;
    animation: gradientBG 20s ease infinite;
    z-index: -2;
    opacity: 0.8;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', sans-serif;
    background: transparent;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #1d1d1f;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

/* Glass Effect */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(200%);
    -webkit-backdrop-filter: blur(16px) saturate(200%);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: var(--spacing-xl);
    box-shadow: var(--glass-shadow);
    margin-bottom: var(--spacing-lg);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Header - Compact */
.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg) 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.logo i {
    font-size: 1.8rem;
    color: rgba(0, 0, 0, 0.8);
}

.logo h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 0.85rem;
    color: rgba(0, 0, 0, 0.6);
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.tagline {
    font-size: 1rem;
    color: rgba(0, 0, 0, 0.7);
    font-weight: 300;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Control Panel - Compact */
.control-panel h2, .harmony-panel h2, .website-preview h2, .palette-section h2 {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-md);
    color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
}

.input-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    align-items: end;
}

.color-input-group, .hex-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

label {
    font-size: 0.85rem;
    color: rgba(0, 0, 0, 0.7);
    font-weight: 500;
}

.input-with-preview {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

#colorPicker {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: transparent;
    padding: 0;
    transition: var(--transition-smooth);
}

#colorPicker:hover {
    transform: scale(1.05);
}

.color-preview {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(0, 0, 0, 0.5);
    font-size: 0.9rem;
}

#hexInput {
    width: 100%;
    padding: 12px 12px 12px 36px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.3);
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    color: rgba(0, 0, 0, 0.9);
    font-weight: 500;
    letter-spacing: 1px;
    transition: var(--transition-smooth);
}

#hexInput:focus {
    outline: none;
    border-color: rgba(100, 126, 234, 0.5);
    background: rgba(255, 255, 255, 0.4);
}

.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

/* Buttons - Compact with hover labels */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.btn:hover .btn-text {
    opacity: 1;
    transform: translateX(0);
}

.btn-icon {
    font-size: 1rem;
}

.btn-text {
    opacity: 0.9;
    transition: var(--transition-smooth);
}

/* Specific button styles */
.btn-generate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-random {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Harmony Buttons - Icon only with hover labels */
.harmony-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--spacing-sm);
}

.harmony-btn {
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    color: rgba(0, 0, 0, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.harmony-btn i {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.harmony-btn .btn-label {
    font-size: 0.75rem;
    opacity: 0.7;
    transition: var(--transition-smooth);
    transform: translateY(2px);
}

.harmony-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.harmony-btn:hover .btn-label {
    opacity: 1;
    transform: translateY(0);
}

.harmony-btn.active {
    background: rgba(100, 126, 234, 0.15);
    border-color: rgba(100, 126, 234, 0.3);
    color: #667eea;
    box-shadow: 0 4px 12px rgba(100, 126, 234, 0.15);
}

.harmony-btn.active .btn-label {
    opacity: 1;
    font-weight: 600;
}

/* Website Preview - Compact */
.website-preview {
    position: relative;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.readability-score {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(52, 199, 89, 0.1);
    border: 1px solid rgba(52, 199, 89, 0.2);
    border-radius: 12px;
    color: #34C759;
    font-weight: 600;
    font-size: 0.85rem;
}

.readability-score i {
    font-size: 0.9rem;
}

.preview-container {
    margin-bottom: var(--spacing-lg);
    max-height: 400px;
    overflow: hidden;
    border-radius: 16px;
}

.website-mockup {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transform: scale(0.95);
    transform-origin: top center;
    transition: var(--transition-smooth);
    max-width: 800px;
    margin: 0 auto;
}

.website-mockup:hover {
    transform: scale(0.96);
}

.mockup-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: inherit;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: inherit;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.nav-link:hover {
    opacity: 1;
}

.mockup-hero {
    padding: 40px 24px;
    text-align: center;
    background: inherit;
}

.hero-title {
    font-size: 1.8rem;
    margin-bottom: 12px;
    font-weight: 700;
    color: inherit;
}

.hero-text {
    font-size: 0.95rem;
    max-width: 500px;
    margin: 0 auto 20px;
    opacity: 0.7;
    line-height: 1.5;
    color: inherit;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.mockup-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    min-width: 120px;
}

.mockup-btn:hover {
    transform: translateY(-1px);
}

.primary-btn {
    background: inherit;
    color: white;
}

.secondary-btn {
    background: rgba(0, 0, 0, 0.05);
    color: inherit;
}

.mockup-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    padding: 30px 24px;
    background: rgba(0, 0, 0, 0.02);
}

.feature-card {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    transition: var(--transition-smooth);
}

.feature-card:hover {
    transform: translateY(-3px);
}

.feature-card i {
    font-size: 1.5rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.feature-card h4 {
    margin-bottom: 8px;
    font-size: 1rem;
    color: inherit;
}

.feature-card p {
    font-size: 0.85rem;
    opacity: 0.6;
    color: inherit;
}

.mockup-footer {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: inherit;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    color: inherit;
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    text-decoration: none;
    color: inherit;
    opacity: 0.6;
    transition: opacity 0.3s;
    font-size: 0.85rem;
}

.footer-links a:hover {
    opacity: 1;
}

/* Preview Controls - Inline with readability score */
.preview-controls {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    margin-top: var(--spacing-md);
}

.btn-optimize, .btn-shuffle {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 10px;
    min-width: auto;
    flex: 1;
}

.btn-optimize {
    background: linear-gradient(135deg, #34C759, #32D74B);
    color: white;
    order: -1; /* Move to left */
}

.btn-shuffle {
    background: rgba(255, 149, 0, 0.1);
    color: #FF9500;
    border: 1px solid rgba(255, 149, 0, 0.2);
}

/* Palette Section - Compact */
.palette-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.palette-name {
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.7);
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.color-swatch {
    aspect-ratio: 1;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.color-swatch:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.color-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px;
    transform: translateY(100%);
    transition: transform 0.3s;
    border-radius: 0 0 14px 14px;
    font-size: 0.75rem;
}

.color-swatch:hover .color-info {
    transform: translateY(0);
}

.hex-code {
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.rgb-code {
    font-size: 0.7rem;
    opacity: 0.8;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

.contrast-warning {
    background: #FF3B30;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    margin-top: 4px;
    display: inline-block;
}

.palette-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--spacing-sm);
}

.btn-export {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-copy {
    background: linear-gradient(135deg, #AF52DE, #BF5AF2);
    color: white;
}

/* Footer */
.footer {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg) 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-xl);
    align-items: center;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-brand i {
    font-size: 1.8rem;
    color: rgba(0, 0, 0, 0.8);
}

.footer-brand h3 {
    font-size: 1.4rem;
    color: rgba(0, 0, 0, 0.9);
}

.footer-brand p {
    color: rgba(0, 0, 0, 0.6);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-link {
    color: rgba(0, 0, 0, 0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
    padding: 8px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.footer-link:hover {
    color: rgba(0, 0, 0, 0.9);
    background: rgba(0, 0, 0, 0.05);
}

.footer-info {
    text-align: center;
    color: rgba(0, 0, 0, 0.5);
    font-size: 0.85rem;
}

/* Notification Toast - Slim */
.notification-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 18px;
    background: rgba(40, 40, 40, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition-smooth);
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
}

.notification-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.notification-toast i {
    color: #34C759;
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: var(--spacing-sm);
    }

    .logo h1 {
        font-size: 1.8rem;
    }

    .input-section {
        grid-template-columns: 1fr;
    }

    .harmony-buttons {
        grid-template-columns: repeat(3, 1fr);
    }

    .palette-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--spacing-sm);
    }

    .mockup-features {
        grid-template-columns: 1fr;
    }

    .mockup-footer {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .preview-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
    }

    .preview-controls {
        order: 3;
        margin-top: var(--spacing-md);
    }

    .readability-score {
        order: 2;
        justify-content: center;
    }

    .website-preview h2 {
        order: 1;
    }
}

@media (max-width: 480px) {
    .harmony-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .palette-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .logo {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .subtitle {
        margin-left: 0;
    }

    .btn-text {
        display: none;
    }

    .btn:hover .btn-text {
        display: inline;
        position: absolute;
        background: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 4px 8px;
        border-radius: 6px;
        top: -30px;
        left: 50%;
        transform: translateX(-50%);
        white-space: nowrap;
        font-size: 0.8rem;
        z-index: 10;
    }

    .btn:hover .btn-text::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        border-width: 4px;
        border-style: solid;
        border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate {
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scrollbar - Slim */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Micro-interactions */
.btn:active {
    transform: scale(0.98);
}

.harmony-btn:active {
    transform: scale(0.96);
}

.color-swatch:active {
    transform: scale(0.95);
}

/* Focus styles for accessibility */
#hexInput:focus,
#colorPicker:focus,
.btn:focus,
.harmony-btn:focus {
    outline: 2px solid rgba(100, 126, 234, 0.4);
    outline-offset: 2px;
}

/* Loading state for optimize button */
.btn-optimize.loading {
    position: relative;
    color: transparent;
}

.btn-optimize.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}