/* style.css */
:root {
    --bg-color: #050505;
    /* Matte Black */
    --card-bg: #141414;
    /* Slightly lighter matte */
    --text-primary: #ffffff;
    /* Pure White */
    --text-secondary: #9e9e9e;
    /* Light Gray */
    --accent-color: #ffffff;
    /* White accent */
    --accent-hover: #e0e0e0;
    /* Off-white hover */
    --border-color: #333333;
    --input-bg: #1f1f1f;
    --danger: #ff4d4d;
    /* Red is still needed for danger, but keep it flat */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-hover);
}

/* Auth Container */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-card {
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.login-card h2 {
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 6px;
    background-color: var(--accent-color);
    color: #121212;
    /* Dark text on light accent for contrast */
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    width: 100%;
    font-size: 1rem;
}

.btn:hover {
    background-color: var(--accent-hover);
}

.btn:active {
    transform: scale(0.98);
}

.w-auto {
    width: auto;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #b05565;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 250px;
    background-color: var(--card-bg);
    padding: 2rem 1rem;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar h3 {
    margin-bottom: 2rem;
    font-size: 1.2rem;
    color: var(--accent-color);
    text-align: center;
}

.nav-link {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--text-secondary);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 1.8rem;
}

/* Invoice Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    min-width: 600px;
    /* Force minimum width to trigger scroll */
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #252525;
    color: var(--text-secondary);
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.action-btn {
    margin-right: 15px;
    font-size: 1.1rem;
    display: inline-block;
    vertical-align: middle;
}

.action-btn:last-child {
    margin-right: 0;
}

/* Invoice Form Specifics */
.invoice-items {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.item-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}

.item-row input {
    margin-bottom: 0;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: 260px;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        width: 100%;
        padding: 1.5rem;
    }

    .menu-toggle {
        display: block !important;
        /* Force show on mobile */
    }

    .item-row {
        flex-direction: column;
        align-items: stretch;
    }

    /* Overlay effect */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar.active+.sidebar-overlay {
        display: block;
    }
}

.menu-toggle {
    display: none;
    /* Hidden on desktop */
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.8rem;
    cursor: pointer;
    margin-right: 1rem;
    padding: 0;
    line-height: 1;
}

/* Invoice Design - Mockup Match */
.invoice-box {
    background-color: white;
    color: #121212;
    padding: 3rem 4rem;
    /* Generous padding like mock */
    font-family: 'Inter', sans-serif;
    /* Mock uses clean sans-serif */
    /* box-shadow: 0 5px 30px rgba(0, 0, 0, 0.1); Remove shadow for seamless look */
    /* margin: 0 auto; Removed for seamless look */
    max-width: 100%;
    position: relative;
    min-height: 1100px;
    /* Force A4-ish height ratio visually */
    display: flex;
    flex-direction: column;
}

/* Header */
.header-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4rem;
}

.company-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-wrapper {
    margin-bottom: 1rem;
}

.logo-wrapper img {
    max-height: 64px;
    width: auto;
}

.address-lines p {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.4;
    margin: 0;
}

.invoice-details {
    text-align: right;
}

.invoice-title-text {
    font-size: 3rem;
    font-weight: 700;
    color: #e0e0e0;
    /* Very light grey */
    margin: 0 0 1rem 0;
    letter-spacing: 2px;
}

.detail-row {
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
    color: #333;
}

.detail-row strong {
    color: #555;
    margin-right: 5px;
}

/* Bill To */
.bill-to-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.section-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.client-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.client-address {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
}

/* Table */
.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 3rem;
    background-color: white;
    /* Override global dark table bg */
}

.invoice-table th {
    text-align: left;
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 700;
    border-bottom: 2px solid #000;
    /* Bold black line */
    padding-bottom: 1rem;
    letter-spacing: 0.5px;
    background: white;
    /* Override dashboard dark header */
    color: #000;
}

.invoice-table td {
    padding: 1.5rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
}

.col-desc {
    width: 50%;
}

.col-qty {
    width: 10%;
    text-align: center;
}

.col-price {
    width: 20%;
    text-align: right;
}

.col-total {
    width: 20%;
    text-align: right;
}

.invoice-table th.col-qty,
.invoice-table th.col-price,
.invoice-table th.col-total {
    text-align: inherit;
    /* Allow classes to dictate alignment */
}

/* Bottom Section */
.bottom-section {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    /* Push to bottom if content short */
    margin-bottom: 4rem;
}

.bank-details-card {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    width: 45%;
    font-size: 0.9rem;
}

.bank-details-card h4 {
    text-transform: uppercase;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    color: #000;
}

.bank-content {
    line-height: 1.6;
    color: #555;
}

.totals-section {
    width: 40%;
    text-align: right;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    font-size: 1rem;
    color: #555;
}

.total-row.grand-total {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #000;
}

/* Footer */
.invoice-footer {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.small-text {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Actions Bar */
.actions-bar {
    max-width: 900px;
    margin: 20px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-link {
    color: #333;
    text-decoration: underline;
}


/* Print Styles */
@media print {
    @page {
        margin: 0;
        size: A4;
    }

    body {
        margin: 0;
        background-color: white !important;
        -webkit-print-color-adjust: exact;
    }

    .invoice-box {
        box-shadow: none;
        margin: 0;
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        padding: 40px;
        /* Safe print padding */
    }

    /* Hide UI */
    .actions-bar,
    .sidebar,
    .header,
    .btn,
    .btn-danger {
        display: none !important;
    }

    /* Gray background for bank details needs to force print */
    .bank-details-card {
        background-color: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}