/* ========================================
   Base64 Image Converter — Styles
   ======================================== */

:root {
    --primary: #6C63FF;
    --primary-hover: #5A52E0;
    --primary-glow: rgba(108, 99, 255, 0.25);
    --secondary: #00D4AA;
    --secondary-hover: #00B894;
    --accent: #FF6B9D;
    --bg-primary: #0F0A1A;
    --bg-secondary: #1A1128;
    --bg-card: rgba(26, 17, 40, 0.7);
    --bg-card-hover: rgba(40, 28, 66, 0.7);
    --bg-input: rgba(15, 10, 26, 0.6);
    --border: rgba(108, 99, 255, 0.15);
    --border-hover: rgba(108, 99, 255, 0.35);
    --text-primary: #F0ECF9;
    --text-secondary: #9B8FC2;
    --text-muted: #6B5F8A;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--primary-glow);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(108, 99, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 212, 170, 0.06) 0%, transparent 50%);
}

/* App Container */
.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-sm);
    color: white;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem;
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.tab:hover {
    color: var(--text-secondary);
    background: rgba(108, 99, 255, 0.06);
}

.tab.active {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.2), rgba(0, 212, 170, 0.1));
    color: var(--text-primary);
    box-shadow: var(--shadow-glow);
}

/* Panels */
.panel {
    display: none;
}

.panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.05), rgba(0, 212, 170, 0.03));
    opacity: 0;
    transition: opacity var(--transition);
}

.drop-zone:hover,
.drop-zone:focus-visible {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.drop-zone:hover::before,
.drop-zone:focus-visible::before {
    opacity: 1;
}

.drop-zone.drag-over {
    border-color: var(--secondary);
    background: rgba(0, 212, 170, 0.06);
    transform: scale(1.01);
}

.drop-zone-content {
    position: relative;
    z-index: 1;
}

.drop-icon {
    color: var(--text-muted);
    margin-bottom: 1rem;
    transition: color var(--transition), transform var(--transition);
}

.drop-zone:hover .drop-icon {
    color: var(--primary);
    transform: translateY(-2px);
}

.drop-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.browse-link {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.drop-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Cards */
.preview-card,
.options-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.preview-card h3,
.options-card h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.preview-row {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.preview-image-wrap {
    width: 100%;
    max-height: 280px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.preview-image-wrap img {
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
}

.file-meta {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    background: rgba(108, 99, 255, 0.1);
    border: 1px solid rgba(108, 99, 255, 0.2);
    border-radius: 100px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Options */
.option-group {
    margin-bottom: 1rem;
}

.option-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slider-row span {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    min-width: 36px;
    text-align: right;
}

input[type="number"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition);
}

input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

input[type="number"]::placeholder {
    color: var(--text-muted);
}

/* Output Section */
.output-section {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.output-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.size-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(0, 212, 170, 0.05));
    border: 1px solid rgba(0, 212, 170, 0.25);
    border-radius: 100px;
    font-size: 0.75rem;
    color: var(--secondary);
    font-weight: 600;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    resize: vertical;
    outline: none;
    line-height: 1.5;
    transition: border-color var(--transition);
}

textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea::placeholder {
    color: var(--text-muted);
}

.copy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #8B7BFF);
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-secondary {
    background: rgba(108, 99, 255, 0.1);
    border: 1px solid rgba(108, 99, 255, 0.2);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(108, 99, 255, 0.18);
    border-color: rgba(108, 99, 255, 0.35);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Decode Section */
.decode-input-section {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.decode-input-section h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.decode-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.7rem 1.25rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-color: rgba(0, 212, 170, 0.4);
}

.toast.error {
    border-color: rgba(255, 107, 157, 0.4);
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
    .app {
        padding: 1.25rem 1rem 3rem;
    }

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

    .tab {
        font-size: 0.78rem;
        padding: 0.6rem 0.5rem;
        gap: 0.3rem;
    }

    .tab svg {
        display: none;
    }

    .preview-row {
        grid-template-columns: 1fr;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .copy-actions {
        flex-direction: column;
    }

    .btn {
        justify-content: center;
    }
}