/* style.css - Premium Food-Supplier Theme Design System */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #1e533d; /* Forest Green */
    --primary-light: #d8f3dc;
    --primary-medium: #52b788;
    --secondary: #f4a261; /* Warm Honey Amber */
    --secondary-dark: #e76f51;
    --background: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #e2e8f0;
    --danger: #e74c3c;
    --success: #2ecc71;
    --info: #3498db;
    --font-sans: 'Plus Jakarta Sans', sans-serif;
    
    --shadow-sm: 0 2px 4px rgba(30, 83, 61, 0.04);
    --shadow-md: 0 8px 16px rgba(30, 83, 61, 0.06);
    --shadow-lg: 0 16px 32px rgba(30, 83, 61, 0.08);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* App Container Layout */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    background-color: var(--primary);
    color: #ffffff;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand-icon {
    font-size: 1.8rem;
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-brand-name {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition);
    color: rgba(255, 255, 255, 0.85);
}

.sidebar-item a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(4px);
}

.sidebar-item.active a {
    background-color: var(--secondary);
    color: var(--primary);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(244, 162, 97, 0.3);
}

.sidebar-user {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    max-width: 140px;
}

.sidebar-username {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background-color: var(--danger);
    transform: scale(1.1);
}

/* Main Content Area */
.main-content {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.page-title p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

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

.btn-primary:hover {
    background-color: #153b2b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 83, 61, 0.15);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--primary);
}

.btn-secondary:hover {
    background-color: #e59352;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 162, 97, 0.2);
}

.btn-light {
    background-color: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-light:hover {
    background-color: var(--background);
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* Card Styling */
.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
    border: 1px solid rgba(30, 83, 61, 0.05);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Grid Layouts */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary {
    background-color: var(--primary-light);
    color: var(--primary);
}

.stat-icon.secondary {
    background-color: #fef5ec;
    color: var(--secondary);
}

.stat-icon.success {
    background-color: #e8f8f0;
    color: var(--success);
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    background: #ffffff;
}

.table th {
    background-color: #f8fafc;
    padding: 1rem 1.25rem;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.92rem;
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background-color: #fafbfc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background-color: #e8f8f0;
    color: var(--success);
}

.badge-warning {
    background-color: #fffbeb;
    color: var(--secondary);
}

.badge-danger {
    background-color: #fdf2f2;
    color: var(--danger);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-medium);
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(30, 83, 61, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background-color: #ffffff;
    border-radius: 20px;
    width: 90%;
    max-width: 550px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-backdrop.show .modal {
    transform: translateY(0);
}

.modal-header {
    background-color: var(--primary);
    color: #ffffff;
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.btn-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: var(--transition);
}

.btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.75rem;
}

.modal-footer {
    padding: 1.25rem 1.75rem;
    background-color: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Excel Import UI Specific */
.file-upload-zone {
    border: 2px dashed var(--primary-medium);
    background-color: var(--primary-light);
    background-opacity: 0.1;
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.file-upload-zone:hover {
    background-color: rgba(82, 183, 136, 0.15);
    border-color: var(--primary);
}

.file-upload-icon {
    font-size: 3rem;
    color: var(--primary);
}

.file-upload-text {
    font-weight: 600;
    color: var(--primary);
}

.file-upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Review Table Input controls */
.editable-input {
    border: 1px solid transparent;
    background: transparent;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: var(--transition);
}

.editable-input:hover {
    border-color: var(--border-color);
    background: #f8fafc;
}

.editable-input:focus {
    border-color: var(--primary-medium);
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(82, 183, 136, 0.15);
    outline: none;
}

.badge-new-item {
    background-color: #fff3cd;
    color: #856404;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 2px;
}

/* Toast System styling */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.toast {
    min-width: 300px;
    max-width: 450px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    border-left: 6px solid var(--primary);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    position: relative;
    overflow: hidden;
}

.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--secondary); }
.toast.info { border-left-color: var(--info); }

.toast-close {
    margin-left: auto;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.6;
    transition: var(--transition);
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Authentication Page layout */
.login-page {
    display: flex;
    height: 100vh;
    background: radial-gradient(circle at 10% 20%, rgba(30, 83, 61, 0.9) 0%, rgba(21, 59, 43, 0.95) 90%), url('https://images.unsplash.com/photo-1542838132-92c53300491e?auto=format&fit=crop&q=80&w=1000') no-repeat center center/cover;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 440px;
    border-radius: 24px;
    padding: 3rem 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.login-logo {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: inline-block;
}

.login-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-form {
    text-align: left;
}

/* Supplier identity details */
.supplier-logo-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    background-color: #f1f5f9;
    border: 1px solid var(--border-color);
}

.supplier-badge-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* -------------------------------------------------------------
   PRINT NOTA TEMPLATES (Screen & Print rules)
   ------------------------------------------------------------- */
.invoice-print-area {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    max-width: 800px;
    margin: 0 auto;
    color: #333333;
}

/* Standard Header structures for Invoices */
.invoice-header-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2.5rem;
    align-items: flex-start;
}

.invoice-logo-container img {
    max-height: 80px;
    max-width: 220px;
    object-fit: contain;
}

.invoice-meta {
    text-align: right;
}

.invoice-meta h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.invoice-details-table {
    width: 100%;
    margin-bottom: 2.5rem;
    border-collapse: collapse;
}

.invoice-details-table th {
    padding: 0.75rem 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.invoice-details-table td {
    padding: 1rem 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.invoice-totals {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 3rem;
}

.invoice-totals-table {
    width: 320px;
}

.invoice-totals-table tr td {
    padding: 0.5rem 0;
}

.invoice-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 4rem;
    text-align: center;
}

.invoice-sign-box {
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Template Specific Styles */
/* 1. Template: Modern */
.invoice-theme-modern .invoice-title-badge {
    padding: 0.25rem 0.75rem;
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.invoice-theme-modern th {
    border-bottom: 2px solid var(--theme-color, #1e533d);
    color: var(--theme-color, #1e533d);
}

/* 2. Template: Classic */
.invoice-theme-classic {
    border: 4px double #333;
    padding: 3rem;
}
.invoice-theme-classic .invoice-header-grid {
    border-bottom: 2px solid #333;
    padding-bottom: 1.5rem;
}
.invoice-theme-classic th {
    border-bottom: 2px solid #333;
    border-top: 2px solid #333;
    color: #333333;
}
.invoice-theme-classic td {
    border-bottom: 1px dashed #cccccc;
}

/* 3. Template: Minimalist */
.invoice-theme-minimalist {
    max-width: 500px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #000000;
    padding: 1.5rem;
    border: 1px solid #dddddd;
}
.invoice-theme-minimalist .invoice-header-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1rem;
}
.invoice-theme-minimalist .invoice-meta {
    text-align: center;
}
.invoice-theme-minimalist th {
    border-top: 1px dashed #000000;
    border-bottom: 1px dashed #000000;
    color: #000000;
}
.invoice-theme-minimalist td {
    border-bottom: 1px dotted #dddddd;
    font-size: 0.85rem;
}
.invoice-theme-minimalist .invoice-totals {
    justify-content: flex-end;
}
.invoice-theme-minimalist .invoice-footer {
    grid-template-columns: 1fr 1fr;
    margin-top: 2rem;
}

/* 4. Template: Elegant Corporate */
.invoice-theme-elegant {
    font-family: 'Georgia', serif;
    border-top: 8px solid var(--theme-color, #2c3e50);
    padding: 3rem;
}
.invoice-theme-elegant th {
    border-bottom: 2px solid var(--theme-color, #2c3e50);
    color: var(--theme-color, #2c3e50);
    font-family: var(--font-sans);
    font-weight: 700;
    letter-spacing: 0.5px;
}
.invoice-theme-elegant td {
    border-bottom: 1px solid #e2e8f0;
}
.invoice-theme-elegant .invoice-totals-table {
    border-top: 2px solid var(--theme-color, #2c3e50);
}

/* 5. Template: Organic Food */
.invoice-theme-organic {
    background-color: #fdfbf7;
    border: 2px solid #52b788;
    border-radius: 20px;
    padding: 2.5rem;
}
.invoice-theme-organic th {
    background-color: #e8f8f0;
    color: #1e533d;
    border-bottom: 2px solid #52b788;
    border-radius: 6px;
}
.invoice-theme-organic td {
    border-bottom: 1px dashed #d8f3dc;
}
.invoice-theme-organic .invoice-totals-table {
    border-top: 2px solid #52b788;
}

/* 6. Template: Bold Retro */
.invoice-theme-retro {
    border: 4px solid #111111;
    padding: 2.5rem;
    box-shadow: 8px 8px 0px #111111;
}
.invoice-theme-retro th {
    background-color: #111111;
    color: #ffffff;
    text-transform: uppercase;
    font-family: var(--font-sans);
    font-weight: 800;
    letter-spacing: 1.5px;
}
.invoice-theme-retro td {
    border-bottom: 2px solid #111111;
    font-weight: 600;
}
.invoice-theme-retro .invoice-totals-table {
    border-top: 4px solid #111111;
}

/* 7. Template: Clean Tech */
.invoice-theme-cleantech {
    border-radius: 12px;
    border: 1px solid #cbd5e1;
}
.invoice-theme-cleantech th {
    background-color: #f1f5f9;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}
.invoice-theme-cleantech td {
    border-bottom: 1px solid #f1f5f9;
}
.invoice-theme-cleantech .invoice-totals-table {
    border-top: 2px solid #cbd5e1;
}

/* 8. Template: Soft Pastel */
.invoice-theme-pastel {
    background-color: #fafafc;
    border-top: 10px solid var(--theme-color, #a855f7);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.05);
}
.invoice-theme-pastel th {
    color: var(--theme-color, #a855f7);
    border-bottom: 2px solid #f3e8ff;
    font-weight: 600;
}
.invoice-theme-pastel td {
    border-bottom: 1px solid #f3e8ff;
}

/* 9. Template: Industrial Monospace */
.invoice-theme-industrial {
    font-family: 'Courier New', Courier, monospace;
    border: 2px solid #000000;
    padding: 2rem;
}
.invoice-theme-industrial th {
    border: 2px solid #000000;
    background-color: #f3f4f6;
    color: #000000;
    font-weight: 900;
}
.invoice-theme-industrial td {
    border: 1px solid #000000;
}
.invoice-theme-industrial .invoice-totals-table {
    border-top: 2px solid #000000;
}

/* 10. Template: Luxury Gold */
.invoice-theme-luxury {
    background-color: #fffdf9;
    border: 1px solid #d4af37;
    padding: 3.5rem;
    font-family: 'Times New Roman', Times, serif;
}
.invoice-theme-luxury th {
    border-bottom: 1px solid #d4af37;
    color: #8a6d1c;
    font-weight: 400;
    letter-spacing: 2px;
}
.invoice-theme-luxury td {
    border-bottom: 1px solid #f4ecd8;
}
.invoice-theme-luxury .invoice-totals-table {
    border-top: 2px solid #d4af37;
}

/* Print Overrides */
@media print {
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
    }
    
    .app-container {
        display: block !important;
    }
    
    .sidebar,
    .main-content > *:not(.invoice-print-area),
    .header-actions,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .invoice-print-area {
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        border: none !important;
    }
}
