/* =================================================================
   AAROGYAM INDIA - PURCHASES & INVOICES CSS (V1)
================================================================= */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0f172a;
    color: #f8fafc;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 1. HEADER */
.purchases-header {
    height: 60px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-btn {
    background: rgba(51, 65, 85, 0.8);
    border: none;
    color: #fff;
    font-size: 18px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #475569;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #10b981;
}

.brand-title {
    font-size: 15px;
    font-weight: 700;
    color: #f8fafc;
}

.page-main-title {
    font-size: 14px;
    color: #cbd5e1;
    font-weight: 600;
}

/* 2. MAIN CONTENT */
.purchases-main {
    flex: 1;
    padding: 30px 16px;
    background: #090d16;
}

.purchases-container-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.section-title-box {
    margin-bottom: 24px;
}

.section-title-box h2 {
    font-size: 22px;
    color: #f8fafc;
    margin-bottom: 6px;
}

.section-title-box p {
    font-size: 14px;
    color: #94a3b8;
}

/* Purchases List & Cards */
.purchases-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.purchase-card {
    background: #1e293b;
    padding: 20px;
    border-radius: 14px;
    border: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, border-color 0.2s;
}

.purchase-card:hover {
    border-color: #475569;
    transform: translateY(-2px);
}

.purchase-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.purchase-book-icon {
    font-size: 40px;
    background: rgba(16, 185, 129, 0.1);
    padding: 10px;
    border-radius: 12px;
}

.purchase-details h3 {
    color: #f8fafc;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.purchase-details p {
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 3px;
}

/* Invoice Button Style */
.invoice-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
    transition: all 0.2s;
}

.invoice-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: scale(1.03);
}

/* Loading & Empty States */
.loading-state, .empty-state {
    text-align: center;
    padding: 50px 20px;
    background: #1e293b;
    border-radius: 14px;
    border: 1px solid #334155;
    color: #94a3b8;
}

.empty-icon {
    font-size: 50px;
    margin-bottom: 12px;
}

.empty-state h3 {
    color: #f8fafc;
    font-size: 18px;
    margin-bottom: 8px;
}

.primary-btn {
    background: #059669;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: #047857;
}

/* 3. FOOTER */
.purchases-footer {
    text-align: center;
    padding: 20px;
    background: #1e293b;
    border-top: 1px solid #334155;
    color: #64748b;
    font-size: 12px;
}

/* =================================================================
   4. INVOICE MODAL STYLES
================================================================= */
.invoice-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 15px;
}

.invoice-modal-card {
    background: #1e293b;
    color: #f8fafc;
    border-radius: 16px;
    border: 1px solid #334155;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modal-fade-in 0.3s ease-out;
}

@keyframes modal-fade-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.invoice-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #334155;
}

.invoice-modal-header h3 {
    font-size: 18px;
    color: #fff;
}

.close-modal-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal-btn:hover {
    color: #fff;
}

.invoice-modal-body {
    padding: 25px;
    overflow-y: auto;
}

.invoice-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px dashed #334155;
    padding-bottom: 20px;
}

.invoice-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.invoice-logo img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

.invoice-logo span {
    font-weight: bold;
    font-size: 16px;
}

.invoice-meta {
    text-align: right;
    font-size: 13px;
    color: #cbd5e1;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.invoice-table th, .invoice-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #334155;
}

.invoice-table th {
    background: #334155;
    font-size: 13px;
}

.payment-details {
    font-size: 13px;
    color: #cbd5e1;
    margin-top: 5px;
}

.status-success {
    color: #10b981;
    font-weight: bold;
}

.invoice-modal-footer {
    padding: 15px 20px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    border-top: 1px solid #334155;
}

/* =========================
   Mobile Responsive
========================= */
@media (max-width: 600px) {
    .purchases-header {
        padding: 0 12px;
    }

    .brand-title {
        display: none;
    }

    .page-main-title {
        font-size: 12px;
    }

    .purchase-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .invoice-btn {
        width: 100%;
        text-align: center;
    }
}

/* =========================
   Print Styles for Invoice
========================= */
@media print {
    body * {
        visibility: hidden;
    }
    #invoiceModal, #invoiceModal * {
        visibility: visible;
    }
    #invoiceModal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: #fff !important;
        padding: 0;
        display: block !important;
    }
    .invoice-modal-card {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    .invoice-modal-header, .invoice-modal-footer button {
        display: none !important;
    }
    .invoice-modal-body * {
        color: #000 !important;
    }
}
