/* ============================================
   GST Analyzer Pro — Professional White Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
    --bg-primary: #f4f6f9;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --bg-input: #f8f9fb;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(99, 102, 241, 0.35);
    --text-primary: #1a1a2e;
    --text-secondary: #5a5f7a;
    --text-muted: #9196ab;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
    --accent-blue: #6366f1;
    --accent-purple: #8b5cf6;
    --accent-violet: #a855f7;
    --accent-green: #22c55e;
    --accent-green-dark: #16a34a;
    --accent-red: #ef4444;
    --accent-amber: #f59e0b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 4px 20px rgba(99, 102, 241, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    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;
    overflow-x: hidden;
}

/* Subtle background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(99, 102, 241, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 85%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* --- Layout --- */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-normal);
    box-shadow: 1px 0 8px rgba(0, 0, 0, 0.04);
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand h1 {
    font-size: 1.15rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.sidebar-brand span {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
    display: block;
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-gradient);
    border-radius: 0 4px 4px 0;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.nav-link:hover {
    background: rgba(99, 102, 241, 0.06);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
    font-weight: 600;
}

.nav-link.active::before {
    opacity: 1;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px 40px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

/* --- Dashboard Cards --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.tool-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.tool-card:hover::before {
    opacity: 1;
}

.card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
}

.tool-card:nth-child(2) .card-icon {
    background: rgba(139, 92, 246, 0.08);
    color: var(--accent-purple);
}

.tool-card:nth-child(3) .card-icon {
    background: rgba(34, 197, 94, 0.08);
    color: var(--accent-green);
}

.tool-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.tool-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.card-arrow {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-blue);
    transition: gap var(--transition-fast);
}

.tool-card:hover .card-arrow {
    gap: 10px;
}

/* --- Form Sections --- */
.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-section:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.section-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- File Upload Zone --- */
.upload-zone {
    border: 2px dashed rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    background: var(--bg-input);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-blue);
    background: rgba(99, 102, 241, 0.03);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.06);
}

.upload-zone.has-files {
    border-color: var(--accent-green);
    border-style: solid;
    background: rgba(34, 197, 94, 0.03);
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.upload-zone:hover .upload-icon {
    color: var(--accent-blue);
}

.upload-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.upload-text strong {
    color: var(--accent-blue);
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.file-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(99, 102, 241, 0.05);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
}

.file-item-name {
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.file-item-remove {
    background: none;
    border: none;
    color: var(--accent-red);
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background var(--transition-fast);
    line-height: 1;
}

.file-item-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

input[type="file"] {
    display: none;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(99, 102, 241, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.25);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 25px rgba(34, 197, 94, 0.35);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* --- Progress --- */
.progress-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    display: none;
}

.progress-section.visible {
    display: block;
    animation: fadeInUp 0.3s ease;
}

.progress-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    width: 0%;
    transition: width 0.6s ease;
}

.progress-bar-fill.indeterminate {
    width: 30% !important;
    animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
    0% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(250%);
    }

    100% {
        transform: translateX(-100%);
    }
}

.progress-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-status.success {
    color: var(--accent-green);
}

.progress-status.error {
    color: var(--accent-red);
}

/* --- Results Box --- */
.results-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-top: 24px;
    box-shadow: var(--shadow-sm);
    display: none;
}

.results-box.visible {
    display: block;
    animation: fadeInUp 0.3s ease;
}

.results-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.results-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.results-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.04);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
}

.results-list li .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-blue);
    flex-shrink: 0;
}

/* --- Alert / Toast --- */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
}

.toast-success {
    background: #f0fdf4;
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #15803d;
}

.toast-error {
    background: #fef2f2;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

.toast-info {
    background: #eef2ff;
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--accent-blue);
}

/* --- Spinner --- */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-sm {
    width: 14px;
    height: 14px;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* --- Action Bar (bottom sticky) --- */
.action-bar {
    position: sticky;
    bottom: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 20px 28px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin-top: 8px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

/* --- Responsive --- */
@media (max-width: 1100px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 24px;
    }

    .mobile-toggle {
        display: flex !important;
    }
}

.mobile-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 150;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1.2rem;
    box-shadow: var(--shadow-sm);
}

/* --- Misc --- */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.text-secondary {
    color: var(--text-secondary);
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-blue {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-blue);
}

.badge-purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
}

.badge-green {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-green);
}

/* Hero section for landing */
.hero-section {
    text-align: center;
    padding: 60px 0 20px;
}

.hero-section h2 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-section p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

/* Form row helper */
.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.form-row label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 120px;
    flex-shrink: 0;
}