/* ==========================================================================
   EasyTax Desk - Design System & CSS Stylesheet (easyedits.in)
   ========================================================================== */

:root {
    /* Color Palette - Dark Theme (Default) */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.85);
    --bg-card-hover: #334155;
    --border-color: #334155;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;

    --accent-emerald: #10b981;
    --accent-emerald-light: rgba(16, 185, 129, 0.15);
    --accent-indigo: #6366f1;
    --accent-indigo-light: rgba(99, 102, 241, 0.15);
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: #e2e8f0;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-emerald), var(--accent-indigo));
    color: #fff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
}

.logo-text h1 span {
    color: var(--accent-emerald);
}

.brand-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.financial-year-badge {
    background: var(--accent-indigo-light);
    color: var(--accent-indigo);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Navigation Tabs */
.nav-tabs-wrapper {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 2rem 0;
}

.nav-tabs-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1.25rem;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--text-main);
}

.nav-tab.active {
    color: var(--accent-emerald);
    border-bottom-color: var(--accent-emerald);
}

/* Main Container & Sections */
.app-main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    flex: 1;
    width: 100%;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.section-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.text-accent {
    color: var(--accent-emerald);
}

/* Card Styling */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Grid Layouts */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .grid-2col {
        grid-template-columns: 1fr;
    }
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.col-full { grid-column: span 2; }
.col-half { grid-column: span 1; }

.section-divider {
    border-top: 1px dashed var(--border-color);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent-indigo);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Forms & Inputs */
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Input Group with Salutation Prefix Dropdown */
.input-group-salutation {
    display: flex;
    gap: 0.5rem;
}

.input-group-salutation select.salutation-select {
    width: 105px;
    flex-shrink: 0;
    font-weight: 700;
    color: var(--accent-emerald);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.5rem;
    cursor: pointer;
}

.input-group-salutation input {
    flex: 1;
}

/* Auto Capitalize for Text Inputs */
input[type="text"]:not(.no-capitalize):not(.uppercase-input),
textarea:not(.no-capitalize) {
    text-transform: capitalize;
}

input.uppercase-input {
    text-transform: uppercase;
}

/* Buttons */
.btn {
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-emerald);
    color: #ffffff;
}

.btn-primary:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--accent-indigo);
    color: #ffffff;
}

.btn-secondary:hover {
    background: #4f46e5;
}

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

.btn-outline:hover {
    background: var(--bg-card-hover);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* Results & Tables */
.recommendation-banner {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.banner-new {
    background: var(--accent-emerald-light);
    border: 1px solid var(--accent-emerald);
    color: var(--text-main);
}

.banner-old {
    background: var(--accent-indigo-light);
    border: 1px solid var(--accent-indigo);
    color: var(--text-main);
}

.banner-icon {
    font-size: 1.8rem;
    color: var(--accent-emerald);
}

.comparison-table-wrapper {
    overflow-x: auto;
}

.comparison-table, .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.comparison-table th, .comparison-table td,
.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th, .data-table th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.row-bold td { font-weight: 700; }
.row-total td { 
    font-weight: 800; 
    font-size: 1.05rem; 
    color: var(--accent-emerald); 
    background: rgba(16, 185, 129, 0.05);
}
.highlight-text { color: var(--accent-emerald); font-weight: 700; }

/* Output Boxes */
.output-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.out-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.95rem;
}

.out-total {
    border-bottom: none;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-emerald);
    padding-top: 0.75rem;
}

/* TDS Section Finder Pills & Search */
.search-bar-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-control {
    padding-left: 2.75rem;
    font-size: 1rem;
}

.filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pill-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill-btn.active, .pill-btn:hover {
    background: var(--accent-emerald);
    color: #fff;
    border-color: var(--accent-emerald);
}

/* Invoice Builder & Preview Grid */
.grid-invoice {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
}

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

.invoice-preview-card {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 2.5rem;
}

.inv-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.inv-badge {
    background: #0f172a;
    color: #ffffff;
    padding: 0.2rem 0.8rem;
    display: inline-block;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.inv-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.inv-table th, .inv-table td {
    border: 1px solid #cbd5e1;
    padding: 0.6rem;
    font-size: 0.85rem;
    text-align: left;
}

.inv-table th {
    background: #f1f5f9;
}

.inv-footer-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.inv-totals .tot-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.9rem;
}

.inv-totals .tot-grand {
    font-weight: 800;
    font-size: 1.1rem;
    border-top: 2px solid #0f172a;
    padding-top: 0.5rem;
}

.inv-signature {
    margin-top: 3rem;
    text-align: right;
}

.sig-space {
    height: 50px;
    margin-top: 0.5rem;
    color: #64748b;
    font-style: italic;
}

/* Compliance Calendar Cards */
.grid-calendar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.cal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.cal-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

.badge-urgent { background: rgba(244, 63, 94, 0.2); color: var(--accent-rose); }
.badge-upcoming { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.badge-normal { background: var(--accent-emerald-light); color: var(--accent-emerald); }

.cal-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}

.cal-date {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cal-countdown {
    margin-top: 1rem;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-emerald);
}

/* Draft Certificate Preview Box */
.draft-preview-box {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    font-size: 0.9rem;
}

.table-compact {
    width: 100%;
    border-collapse: collapse;
}

.table-compact td {
    padding: 0.4rem 0;
    border-bottom: 1px solid #e2e8f0;
}

/* Print Rules */
@media print {
    .app-header, .nav-tabs-wrapper, .no-print, .section-header button, .search-bar-row, .pill-btn, .app-footer {
        display: none !important;
    }
    body {
        background: #fff;
        color: #000;
    }
    .tab-content { display: none !important; }
    .tab-content.active { display: block !important; }
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    .grid-invoice { display: block !important; }
    .invoice-preview-card {
        padding: 0 !important;
        border: none !important;
    }
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }
