/* Malaysian E-Invoice System - Main Stylesheet */

:root {
    --primary-color: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-color: #1e293b;
    --light-text: #64748b;
    --white: #ffffff;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

header .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

nav {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    transition: background 0.3s;
    background: rgba(255, 255, 255, 0.1);
}

nav a:hover, nav a.active {
    background: rgba(255, 255, 255, 0.2);
}

/* Content Area */
.content {
    background: var(--white);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

/* Form Sections */
.form-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-left: 4px solid var(--primary-color);
    padding-left: 15px;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.flex-2 {
    grid-column: span 2;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* Info Box */
.info-box {
    background: #f1f5f9;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid var(--primary-color);
}

.info-box p {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.info-box p:last-child {
    margin-bottom: 0;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
    margin-top: 20px;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.invoice-table thead {
    background: var(--primary-color);
    color: white;
}

.invoice-table th,
.invoice-table td {
    padding: 12px 8px;
    text-align: left;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.invoice-table tbody tr:hover {
    background: #f8fafc;
}

.invoice-table input,
.invoice-table select {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.9rem;
}

/* Totals Section */
.totals-section {
    margin-top: 30px;
    margin-left: auto;
    max-width: 400px;
    background: #f8fafc;
    padding: 20px;
    border-radius: 5px;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.totals-row.total {
    border-top: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    margin-top: 10px;
    padding: 15px 0;
    font-size: 1.2rem;
}

.amount {
    color: var(--primary-color);
    font-weight: 600;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1e3a8a;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: var(--light-text);
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 20px;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--text-color);
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Invoice List Styles */
.invoice-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.invoice-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

.invoice-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.invoice-card .invoice-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin: 15px 0;
    font-size: 0.9rem;
}

.invoice-card .invoice-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-draft {
    background: #fef3c7;
    color: #92400e;
}

.status-submitted {
    background: #dbeafe;
    color: #1e40af;
}

.status-validated {
    background: #d1fae5;
    color: #065f46;
}

.status-paid {
    background: #d1fae5;
    color: #065f46;
}

.status-unpaid {
    background: #fee2e2;
    color: #991b1b;
}

.status-cancelled {
    background: #f3f4f6;
    color: #374151;
}

/* Alert Messages */
.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .content {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .invoice-table {
        font-size: 0.8rem;
    }
    
    .invoice-table th,
    .invoice-table td {
        padding: 8px 4px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    header nav,
    .form-actions,
    .btn-primary,
    .btn-secondary {
        display: none;
    }
    
    .content {
        box-shadow: none;
    }
}
