/* ==========================================================================
   PDF Compressor – Custom Styles
   ========================================================================== */

:root {
    --primary: #1a3a8f;
    --primary-light: #2d5bbf;
    --primary-dark: #0f2660;
    --accent: #4a7dff;
    --bg-white: #ffffff;
    --bg-gray: #f4f6fa;
    --bg-gray-dark: #e8ecf4;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #dde3ef;
    --shadow-sm: 0 2px 8px rgba(26, 58, 143, 0.08);
    --shadow-md: 0 8px 30px rgba(26, 58, 143, 0.12);
    --shadow-lg: 0 16px 48px rgba(26, 58, 143, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.25s ease;
    --font: 'Poppins', sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    color: var(--text-dark);
    background-color: var(--bg-white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */
.site-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    font-size: 1.5rem;
    color: #dc3545;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted) !important;
    padding: 0.5rem 1rem !important;
    transition: color var(--transition);
    border-radius: var(--radius-sm);
}

.nav-link:hover,
.nav-link:focus,
.nav-link.active {
    color: var(--primary) !important;
}

.navbar-toggler {
    border-color: var(--border-color);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(26, 58, 143, 0.25);
}

/* ---- Language Switcher ---- */
.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.75rem;
    padding: 0.2rem;
    background: var(--bg-gray);
    border-radius: 999px;
    border: 1px solid var(--border-color);
}

.lang-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.lang-btn:hover,
.lang-btn:focus-visible {
    color: var(--primary);
    outline: none;
}

.lang-btn.active {
    background: var(--primary);
    color: #fff;
}

.lang-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(26, 58, 143, 0.25);
}

@media (max-width: 991.98px) {
    .lang-switcher {
        margin: 0.75rem 0 0.25rem;
    }
}

/* ---- Hero Section ---- */
.hero-section {
    padding: 3rem 0 4rem;
    background: linear-gradient(180deg, var(--bg-gray) 0%, var(--bg-white) 100%);
}

.page-title {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 520px;
    margin: 0 auto;
}

/* ---- Upload Card ---- */
.upload-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem 2rem;
    border: 1px solid var(--border-color);
}

/* ---- Drop Zone ---- */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
    background: var(--bg-gray);
}

.drop-zone:hover,
.drop-zone:focus {
    border-color: var(--accent);
    background: #eef2ff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 125, 255, 0.15);
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background: #e8eeff;
    box-shadow: var(--shadow-sm);
}

.drop-icon {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 1rem;
    display: block;
}

.drop-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.drop-or {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.75rem 0;
}

.drop-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1rem;
    margin-bottom: 0;
}

.btn-browse {
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.5rem;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-browse:hover,
.btn-browse:focus {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ---- Selected File ---- */
.selected-file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-gray);
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    font-size: 0.95rem;
}

.selected-file-info i {
    font-size: 1.25rem;
}

.remove-file-btn {
    margin-left: auto;
    padding: 0;
    font-size: 1.1rem;
}

/* ---- Compression Options ---- */
.options-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-align: center;
}

.compression-card {
    display: block;
    cursor: pointer;
    height: 100%;
}

.compression-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.compression-card-body {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1rem;
    text-align: center;
    height: 100%;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    position: relative;
    background: var(--bg-white);
}

.compression-card:hover .compression-card-body,
.compression-radio:focus + .compression-card-body {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.compression-radio:checked + .compression-card-body {
    border-color: var(--primary);
    background: #f0f4ff;
    box-shadow: 0 0 0 3px rgba(26, 58, 143, 0.12);
}

.compression-card.recommended .compression-card-body {
    border-color: var(--accent);
}

.badge-recommended {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.compression-icon {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: block;
}

.compression-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-dark);
}

.compression-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0;
    line-height: 1.5;
}

/* ---- Buttons ---- */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 0.65rem 2rem;
    transition: background var(--transition), transform 0.15s ease;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-primary:active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-compress {
    min-width: 220px;
}

.btn-outline-secondary {
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.btn:focus-visible,
.compression-radio:focus + .compression-card-body {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Loading ---- */
.loading-container {
    padding: 3rem 1rem;
}

.loading-spinner {
    width: 3.5rem;
    height: 3.5rem;
    border-width: 0.3rem;
    margin-bottom: 1.5rem;
}

.loading-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.loading-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ---- Loading Progress ---- */
.loading-progress-wrap {
    max-width: 420px;
    margin: 0 auto;
    text-align: left;
}

.loading-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.loading-progress-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.loading-percent {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.loading-progress {
    height: 12px;
    border-radius: 20px;
    background: var(--bg-gray-dark);
    overflow: hidden;
}

.loading-progress-bar {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 20px;
    transition: width 0.3s ease;
}

/* ---- Results ---- */
.success-icon-wrap {
    margin-bottom: 0.75rem;
}

.success-icon {
    font-size: 3.5rem;
    color: #22c55e;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.stat-card {
    background: var(--bg-gray);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1rem;
    text-align: center;
    height: 100%;
}

.stat-highlight {
    background: #eef2ff;
    border: 1px solid rgba(26, 58, 143, 0.15);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.stat-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.saved-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ---- Size Comparison Bars ---- */
.size-comparison {
    background: var(--bg-gray);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
}

.comparison-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.comparison-row:last-child {
    margin-bottom: 0;
}

.comparison-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    min-width: 120px;
    flex-shrink: 0;
}

.comparison-bar-wrap {
    flex: 1;
    background: var(--bg-gray-dark);
    border-radius: 6px;
    height: 14px;
    overflow: hidden;
}

.comparison-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s ease;
    min-width: 2%;
}

.bar-original {
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
}

.bar-compressed {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

.result-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* ---- Privacy Notice ---- */
.privacy-notice {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.privacy-notice i {
    margin-right: 0.25rem;
}

/* ---- About Section ---- */
.about-section {
    padding: 4rem 0;
    background: var(--bg-gray);
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 2rem;
}

.about-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.about-item {
    display: flex;
    gap: 1.25rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-color);
}

.about-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.about-item:first-child {
    padding-top: 0;
}

.about-icon {
    font-size: 1.5rem;
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.about-item h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-dark);
}

.about-item p {
    color: var(--text-muted);
    margin-bottom: 0;
    font-size: 0.95rem;
}

.about-item code {
    background: var(--bg-gray);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.875em;
}

.developer-item {
    background: linear-gradient(135deg, #f0f4ff 0%, #eef2ff 100%);
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
    padding: 1.25rem !important;
    border: 1px solid rgba(26, 58, 143, 0.12) !important;
}

.developer-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.35rem;
}

.footer-developer {
    margin-top: 0.35rem;
    margin-bottom: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
}

.footer-developer strong {
    color: #fff;
    font-weight: 600;
}

/* ---- Footer ---- */
.site-footer {
    padding: 1.5rem 0;
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
}

.site-footer p {
    margin: 0;
}

/* ---- Alerts ---- */
.alert-danger {
    border-radius: var(--radius-sm);
    font-size: 0.925rem;
}

/* ---- Responsive ---- */
@media (min-width: 576px) {
    .result-actions {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
}

@media (max-width: 767.98px) {
    .upload-card {
        padding: 1.75rem 1.25rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .comparison-label {
        min-width: 90px;
        font-size: 0.78rem;
    }

    .comparison-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
    }
}

@media (max-width: 575.98px) {
    .hero-section {
        padding: 2rem 0 3rem;
    }

    .btn-compress,
    .result-actions .btn {
        width: 100%;
    }

    .result-actions .ms-sm-2 {
        margin-left: 0 !important;
    }
}

/* ---- Accessibility: reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}
