/* PO Manager — Main Application Styles */
@import url('variables.css');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-family);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.045;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}
body.light-theme::before {
    opacity: 0.03;
}
body.light-theme {
    background: radial-gradient(circle at 50% 50%, #ffffff 0%, #dcdde1 100%) no-repeat fixed;
}
body:not(.light-theme) {
    background: 
        radial-gradient(circle at 15% 15%, rgba(43, 110, 181, 0.5) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(25, 74, 128, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, #103157 0%, #051224 100%) no-repeat fixed;
}
.flatpickr-calendar, .flatpickr-months, .flatpickr-weekdays, .flatpickr-days, .flatpickr-time, .flatpickr-input {
    font-family: var(--font-family) !important;
}
a { color: var(--accent-lime); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--accent-green); }

.app-layout { display: flex; min-height: 100vh; }
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}
.app-content {
    flex: 1;
    padding: 1.5rem 2rem;
    margin-top: var(--topbar-height);
    background: var(--bg-main);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.5px; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
    backdrop-filter: blur(12px);
}
body:not(.light-theme) .card {
    background: rgba(10, 31, 57, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15), 0 10px 30px rgba(0, 0, 0, 0.35) !important;
}
body:not(.light-theme) .card:hover {
    border-color: rgba(0, 229, 255, 0.35) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 15px 35px rgba(0, 229, 255, 0.1), 0 5px 15px rgba(0, 0, 0, 0.4) !important;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}
.card-header h2, .card-header h3 { font-size: 1rem; font-weight: 600; }
.card-menu-btn {
    width: 32px; height: 32px; border-radius: var(--radius-xs);
    border: 1px solid var(--border); background: transparent;
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition-fast);
}
.card-menu-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1.25rem; border: none; border-radius: var(--radius-xs);
    font-family: inherit; font-size: 0.8125rem; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    text-decoration: none; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary {
    background: linear-gradient(135deg, var(--accent-lime), var(--accent-green));
    color: var(--text-inverse);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(200,241,105,0.3); color: var(--text-inverse); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-danger { background: rgba(248,81,73,0.15); color: #f85149; border: 1px solid rgba(248,81,73,0.3); }
.btn-danger:hover { background: rgba(248,81,73,0.25); }
.btn-success { background: rgba(168,216,185,0.15); color: var(--accent-green); border: 1px solid rgba(168,216,185,0.3); }
.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.75rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 0.9375rem; }
.btn-group { display: flex; gap: 0.5rem; }

.badge {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.25rem 0.75rem; border-radius: 20px;
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.badge-draft { background: rgba(110,118,129,0.15); color: #6e7681; }
.badge-draft::before { background: #6e7681; }
.badge-pending { background: rgba(248,180,0,0.15); color: #f8b400; }
.badge-pending::before { background: #f8b400; }
.badge-partial { background: rgba(184,181,225,0.15); color: #b8b5e1; }
.badge-partial::before { background: #b8b5e1; }
.badge-approved { background: rgba(168,216,185,0.15); color: #a8d8b9; }
.badge-approved::before { background: #a8d8b9; }
.badge-rejected { background: rgba(248,81,73,0.15); color: #f85149; }
.badge-rejected::before { background: #f85149; }
.badge-cancelled { background: rgba(110,118,129,0.1); color: #6e7681; }
.badge-cancelled::before { background: #6e7681; }
.badge-cost-pending { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.badge-cost-pending::before { background: #38bdf8; }

.alert {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.875rem 1.25rem; border-radius: var(--radius-sm);
    font-size: 0.875rem; margin-bottom: 1.25rem;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
.alert-success { background: rgba(168,216,185,0.1); border: 1px solid rgba(168,216,185,0.3); color: var(--accent-green); }
.alert-error { background: rgba(248,81,73,0.1); border: 1px solid rgba(248,81,73,0.3); color: #f85149; }
.alert-warning { background: rgba(248,180,0,0.1); border: 1px solid rgba(248,180,0,0.3); color: var(--accent-peach); }
.alert-info { background: rgba(88,166,255,0.1); border: 1px solid rgba(88,166,255,0.3); color: var(--accent-blue); }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); width: 100%; max-width: 500px;
    box-shadow: var(--shadow-lg); transform: scale(0.95); transition: var(--transition);
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-light); }
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close { width: 32px; height: 32px; border-radius: var(--radius-xs); border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 1.25rem; }
.modal-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.modal-body { padding: 1.5rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border-light); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; margin-bottom: 1.5rem; }

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

.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent-lime); border-radius: 50%; animation: spin 0.6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-1 { flex: 1; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 768px) { .app-main { margin-left: 0; } .app-content { padding: 1rem; } .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; } }

/* Light Theme Specific Components Overrides */
body.light-theme .badge-draft { background: rgba(100, 116, 139, 0.1); color: #475569; }
body.light-theme .badge-draft::before { background: #475569; }
body.light-theme .badge-pending { background: rgba(217, 119, 6, 0.1); color: #b45309; }
body.light-theme .badge-pending::before { background: #b45309; }
body.light-theme .badge-partial { background: rgba(99, 102, 241, 0.1); color: #4f46e5; }
body.light-theme .badge-partial::before { background: #4f46e5; }
body.light-theme .badge-approved { background: rgba(22, 163, 74, 0.1); color: #15803d; }
body.light-theme .badge-approved::before { background: #15803d; }
body.light-theme .badge-rejected { background: rgba(220, 38, 38, 0.1); color: #b91c1c; }
body.light-theme .badge-rejected::before { background: #b91c1c; }
body.light-theme .badge-cancelled { background: rgba(100, 116, 139, 0.1); color: #64748b; }
body.light-theme .badge-cancelled::before { background: #64748b; }
body.light-theme .badge-cost-pending { background: rgba(14, 165, 233, 0.1); color: #0284c7; }
body.light-theme .badge-cost-pending::before { background: #0284c7; }

body.light-theme .btn-danger { background: rgba(220, 38, 38, 0.08); color: #b91c1c; border-color: rgba(220, 38, 38, 0.2); }
body.light-theme .btn-danger:hover { background: rgba(220, 38, 38, 0.15); }
body.light-theme .btn-success { background: rgba(22, 163, 74, 0.08); color: #15803d; border-color: rgba(22, 163, 74, 0.2); }
body.light-theme .btn-success:hover { background: rgba(22, 163, 74, 0.15); }
body.light-theme .alert-success { background: rgba(22, 163, 74, 0.08); border-color: rgba(22, 163, 74, 0.2); color: #15803d; }
body.light-theme .alert-danger { background: rgba(220, 38, 38, 0.08); border-color: rgba(220, 38, 38, 0.2); color: #b91c1c; }

/* Dark Theme specific Glassmorphism Layout Enhancements */
body:not(.light-theme) .app-content {
    background: transparent;
}
body:not(.light-theme) .sidebar {
    background: rgba(4, 12, 22, 0.8) !important;
    backdrop-filter: blur(20px) saturate(120%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
}
body:not(.light-theme) .topbar {
    background: rgba(4, 12, 22, 0.7) !important;
    backdrop-filter: blur(20px) saturate(120%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}
body:not(.light-theme) .sidebar-logo {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
body:not(.light-theme) .topbar-search input {
    background: rgba(5, 16, 31, 0.65);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}
body:not(.light-theme) .topbar-search input:focus {
    border-color: #00e5ff;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 10px rgba(0, 229, 255, 0.25);
}
body:not(.light-theme) .data-table-wrapper {
    background: rgba(10, 31, 57, 0.55) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15), 0 10px 30px rgba(0, 0, 0, 0.35) !important;
}
body:not(.light-theme) .data-table thead th {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
body:not(.light-theme) .data-table tbody tr {
    border-bottom-color: rgba(255, 255, 255, 0.04);
}
body:not(.light-theme) .data-table tbody tr:hover {
    background: rgba(25, 74, 128, 0.3);
}
body:not(.light-theme) .pagination-wrapper {
    border-top-color: rgba(255, 255, 255, 0.08);
}
body:not(.light-theme) .flatpickr-calendar {
    background: rgba(10, 31, 57, 0.9) !important;
    backdrop-filter: blur(15px);
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 12px 40px rgba(0, 0, 0, 0.45) !important;
}

/* Light Theme Glassmorphism overrides */
body.light-theme .app-content {
    background: transparent;
}
body.light-theme .sidebar {
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(20px) saturate(120%);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.3), 0 4px 30px rgba(0, 0, 0, 0.03);
}
body.light-theme .topbar {
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(20px) saturate(120%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.3), 0 4px 30px rgba(0, 0, 0, 0.03);
}
body.light-theme .sidebar-logo {
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
body.light-theme .card {
    background: rgba(255, 255, 255, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 8px 30px rgba(100, 116, 139, 0.08) !important;
}
body.light-theme .card:hover {
    border-color: rgba(9, 105, 218, 0.35) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.9), 0 12px 35px rgba(9, 105, 218, 0.08), 0 4px 12px rgba(100, 116, 139, 0.08) !important;
}
body.light-theme .data-table-wrapper {
    background: rgba(255, 255, 255, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 8px 30px rgba(100, 116, 139, 0.08) !important;
}
body.light-theme .data-table thead th {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}
body.light-theme .data-table tbody tr {
    border-bottom-color: rgba(0, 0, 0, 0.03);
}
body.light-theme .data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.6);
}
body.light-theme .topbar-search input {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(0, 0, 0, 0.08);
}
body.light-theme .topbar-search input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}
body.light-theme .pagination-wrapper {
    border-top-color: rgba(0, 0, 0, 0.05);
}
body.light-theme .flatpickr-calendar {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(15px);
    border-color: rgba(255, 255, 255, 0.6) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 12px 40px rgba(100, 116, 139, 0.15) !important;
}



