/* === Base (matching aconcept design) === */
:root {
    --bg-dark: #0B0714;
    --bg-card: #141418;
    --bg-card-hover: #1a1a22;
    --purple: #8B5CF6;
    --purple-light: #a78bfa;
    --purple-glow: rgba(139, 92, 246, 0.3);
    --pink: #d946ef;
    --green: #22c55e;
    --yellow: #eab308;
    --red: #ef4444;
    --text: #ffffffee;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

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

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* === Screens === */
.screen {
    display: none;
    min-height: 100vh;
    position: relative;
}

.screen.active {
    display: block;
}

.bg-glow {
    position: fixed;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, var(--purple-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

/* === Logo === */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.logo-icon {
    font-size: 32px;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -0.5px;
}

/* === Landing === */
.landing-header {
    padding: 32px 0;
}

.landing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 100px);
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -1.5px;
}

.hero-line {
    display: block;
}

.gradient-text {
    background: linear-gradient(135deg, var(--purple) 0%, var(--pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 500px;
    margin-bottom: 48px;
}

/* === Form === */
.url-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 560px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 4px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-glow);
}

.input-icon {
    padding: 0 12px;
    font-size: 20px;
    opacity: 0.6;
}

#url-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 1.1rem;
    font-family: var(--font-body);
    padding: 16px 16px 16px 4px;
}

#url-input::placeholder {
    color: var(--text-dim);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--purple) 0%, var(--pink) 100%);
    color: white;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--purple-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background: var(--bg-card);
    color: var(--text);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.disclaimer {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* === Loading === */
.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    position: relative;
    z-index: 1;
}

.loading-icon {
    font-size: 64px;
    margin-bottom: 24px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.loading-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 32px;
}

.loading-bar-wrapper {
    width: 100%;
    max-width: 400px;
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--pink));
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* === Results Header === */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
}

.results-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.results-site-info {
    text-align: center;
    padding: 32px 0 40px;
    position: relative;
    z-index: 1;
}

.results-site-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.results-site-url {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* === Section Headers === */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.section-icon {
    font-size: 24px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
}

/* === Mode Toggle === */
.mode-toggle {
    margin-left: auto;
    display: flex;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.mode-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 16px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

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

.mode-btn.active {
    background: var(--purple);
    color: white;
}

/* === Color Palette Section === */
.brand-section {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
}

.color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.color-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.15s;
}

.color-card:hover {
    transform: scale(1.05);
}

.color-swatch {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}

.color-swatch:hover {
    border-color: var(--purple-light);
}

.color-swatch input[type="color"] {
    position: absolute;
    inset: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    border: none;
    cursor: pointer;
    opacity: 0;
}

.color-hex {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.color-role {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: capitalize;
}

/* === Font Section === */
.font-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.font-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.font-specimen {
    flex: 1;
    min-width: 200px;
}

.font-name {
    font-size: 0.8rem;
    color: var(--purple-light);
    font-family: var(--font-heading);
    font-weight: 600;
    margin-bottom: 4px;
}

.font-preview-text {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

.font-select-wrapper {
    position: relative;
}

.font-select {
    appearance: none;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 10px 36px 10px 14px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 200px;
}

.font-select:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-glow);
}

.font-select-wrapper::after {
    content: "▾";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* === Live Preview === */
.preview-frame {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 500px;
}

.preview-content {
    padding: 0;
    width: 100%;
    min-height: 500px;
}

.preview-content .preview-nav {
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-content .preview-nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
}

.preview-content .preview-nav-links {
    display: flex;
    gap: 24px;
    font-size: 0.9rem;
}

.preview-content .preview-hero {
    padding: 60px 32px;
    text-align: center;
}

.preview-content .preview-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
}

.preview-content .preview-hero p {
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto 28px;
    opacity: 0.8;
}

.preview-content .preview-hero-btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    border: none;
    cursor: default;
}

.preview-content .preview-cards {
    padding: 40px 32px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.preview-content .preview-card {
    padding: 24px;
    border-radius: 12px;
    text-align: center;
}

.preview-content .preview-card-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.preview-content .preview-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.preview-content .preview-card p {
    font-size: 0.85rem;
    opacity: 0.7;
    line-height: 1.5;
}

/* === Export Section === */
.export-section {
    text-align: center;
    padding: 48px 0 80px;
}

.export-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(217, 70, 239, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
}

.export-card h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.export-card p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 28px;
}

/* === Error Overlay === */
.error-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 7, 20, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.error-card {
    background: var(--bg-card);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    max-width: 400px;
}

.error-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.error-card h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.error-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* === Print / Export Styles === */
@media print {
    body {
        background: white !important;
        color: #111 !important;
    }

    .screen { display: none !important; }
    .bg-glow { display: none !important; }
    .error-overlay { display: none !important; }
    .results-actions { display: none !important; }
    .export-section { display: none !important; }
    .preview-frame { break-inside: avoid; }

    #screen-results {
        display: block !important;
    }

    .brand-section {
        background: #f9f9f9 !important;
        border-color: #ddd !important;
        break-inside: avoid;
    }

    .color-swatch {
        border-color: #ccc !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .section-title, .results-site-title {
        color: #111 !important;
    }

    .color-hex, .color-role, .font-name {
        color: #555 !important;
    }

    .font-select-wrapper { display: none !important; }
}

/* === Responsive === */
@media (max-width: 768px) {
    .preview-content .preview-cards {
        grid-template-columns: 1fr;
    }

    .font-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .font-select {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: 2.2rem;
    }

    .url-form {
        padding: 0 8px;
    }

    .color-swatch {
        width: 56px;
        height: 56px;
    }

    .results-header {
        flex-direction: column;
        gap: 12px;
    }
}

/* === Home Hub === */
.hub-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 60px;
    position: relative;
    z-index: 1;
}

.hub-content .hero-subtitle {
    margin-bottom: 48px;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
    max-width: 700px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 36px 28px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: var(--purple);
    box-shadow: 0 8px 30px var(--purple-glow);
}

.tool-card-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.tool-card-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.tool-card-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* === Logo as link === */
a.logo {
    text-decoration: none;
    color: inherit;
}

/* === Convert Page === */
.convert-page {
    max-width: 700px;
    margin: 0 auto;
    padding-top: 40px;
    padding-bottom: 80px;
    position: relative;
    z-index: 1;
}

.convert-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1px;
    margin-bottom: 12px;
    text-align: center;
}

.convert-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    text-align: center;
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Quality slider */
.quality-control {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.quality-control label {
    white-space: nowrap;
    color: var(--text-muted);
}

.quality-control strong {
    color: var(--text);
    font-family: var(--font-heading);
}

#quality-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    outline: none;
}

#quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--purple);
    cursor: pointer;
    border: 2px solid var(--bg-dark);
}

#quality-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--purple);
    cursor: pointer;
    border: 2px solid var(--bg-dark);
}

/* Drop zone */
.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 32px;
}

.drop-zone:hover,
.drop-zone--over {
    border-color: var(--purple);
    background: rgba(139, 92, 246, 0.05);
}

.drop-zone-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.drop-zone-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.drop-zone-hint {
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* Results area */
.convert-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.result-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-sizes {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.result-status {
    font-size: 0.85rem;
    color: var(--yellow);
}

.result-status--done {
    color: var(--green);
}

.result-status--error {
    color: var(--red);
}

.result-download {
    padding: 8px 16px;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }

    .result-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-actions {
        width: 100%;
        justify-content: space-between;
    }
}
