
:root {
    --primary-color: #004694 !important;
    --secondary-color: #ffffff !important;
    --accent-color: #0075f6 !important;
    --text-color: #1e293b !important;
    --background-color: #eef2f7 !important;
    --card-background: #ffffff !important;
    --button-primary: #0075f6 !important;
    --button-hover: #004694 !important;
}

body {
    font-family: 'Poppins', sans-serif !important;
    background: var(--background-color) !important;
    color: var(--text-color) !important;
}

header { color: #ffffff !important;
    background: #004694 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    border-bottom: none !important;
}

.sidebar {
    background: #ffffff !important;
    color: #1e293b !important;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.05) !important;
    border-right: 1px solid #e2e8f0 !important;
}

.sidebar a { color: #64748b !important; border-radius: 8px !important; margin: 2px 0 !important; padding: 8px 15px !important; font-weight: 500 !important; font-size: 13.5px !important; transition: all 0.3s ease !important; display: flex !important; align-items: center !important; text-decoration: none !important; }

.sidebar a i { width: 22px !important; font-size: 15px !important; text-align: center !important; margin-right: 8px !important; color: #94a3b8 !important; }

.sidebar a:hover, .sidebar a.active {
    background: #eef2f7 !important;
    color: #0075f6 !important;
}

.sidebar a:hover i, .sidebar a.active i {
    color: #0075f6 !important;
}

.user-profile {
    border-bottom: 1px solid #e2e8f0 !important;
    margin-bottom: 10px !important;
    padding-bottom: 20px !important;
}

.profile-name {
    color: #1e293b !important;
    font-weight: 600 !important;
}

.btn-primary, button.btn[onclick="savePO()"], button[name="login"] {
    background: #004694 !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 10px rgba(0, 117, 246, 0.3) !important;
    color: #fff !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
}

.btn-primary:hover, button.btn[onclick="savePO()"]:hover, button[name="login"]:hover {
    box-shadow: 0 6px 15px rgba(0, 70, 148, 0.4) !important;
    transform: translateY(-2px) !important;
}

.card, .po-section, .form-section, .login-box {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.03) !important;
    padding: 20px !important;
}

.history-table th, table th { background: #004694 !important; color: #ffffff !important; font-weight: 500 !important; border: none !important; text-transform: uppercase !important; font-size: 13px !important; letter-spacing: 1px !important; padding: 12px 15px !important; }

table td {
    border: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    color: #334155 !important;
}

input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background-color: #f8fafc !important;
    padding: 10px 15px !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
}

input:focus, select:focus, textarea:focus {
    border-color: #0075f6 !important;
    box-shadow: 0 0 0 3px rgba(0, 117, 246, 0.1) !important;
    background-color: #ffffff !important;
    outline: none !important;
}

h e a d e header a, header nav a { color: #ffffff !important; }

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-profile-section {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.3s;
}

.user-profile-section:hover {
    background: rgba(255, 255, 255, 0.1);
}

.profile-picture img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffffff;
}

.profile-info {
    display: flex;
    flex-direction: column;
    color: #ffffff;
}

.profile-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
    color: #ffffff !important;
}

.profile-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 200px;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.profile-dropdown.show {
    display: block;
}

.profile-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: #475569 !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.profile-dropdown a:hover {
    background: #f1f5f9;
    color: #0075f6 !important;
}

.profile-dropdown a i {
    color: #94a3b8;
}

.sidebar { width: 250px !important; padding: 20px 10px !important; }

.main-content {
    margin-left: 250px !important;
}
@media (max-width: 768px) { .main-content { margin-left: 0 !important; } }

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #004694;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #0075f6;
}

h2, h3, .form-section h3 {
    color: #004694 !important;
    font-weight: 600 !important;
    position: relative !important;
    border-bottom: none !important;
    padding-bottom: 10px !important;
}

h2::after {
    content: "" !important;
    position: absolute !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 60px !important;
    height: 4px !important;
    background: #004694 !important;
    border-radius: 2px !important;
}

@media (max-width: 768px) {
    header {
        padding: 10px 15px !important;
    }
    
    .header-left h1 {
        display: none !important; /* Hide title text on mobile, keep logo */
    }
    
    .header-right {
        gap: 10px !important;
    }
    
    .weather-container {
        display: none !important; /* Hide weather on mobile to save space */
    }
    
    .profile-info {
        display: none !important; /* Hide name/role text, keep just the photo */
    }
    
    .profile-picture img {
        width: 30px !important;
        height: 30px !important;
    }
    
    .user-profile-section {
        padding: 2px !important;
    }
    
    .header-logo {
        max-height: 30px !important;
    }
    
    .hamburger {
        font-size: 20px !important;
        margin-right: 10px !important;
    }
    
    /* Ensure cards stack neatly on mobile */
    .dashboard-stats {
        grid-template-columns: 1fr !important;
    }
    
    .po-section {
        padding: 15px 10px !important;
    }
    
    .profile-dropdown {
        right: -10px !important; /* Align dropdown with right edge on mobile */
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        z-index: 9999 !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out !important;
        background: #ffffff !important;
        box-shadow: 2px 0 15px rgba(0,0,0,0.2) !important;
    }
    .sidebar.active {
        transform: translateX(0) !important;
    }
    
    /* Overlay for mobile sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 9998;
    }
    .sidebar-overlay.active {
        display: block;
    }
}
@media (max-width: 768px) { .size-row, .revised-po-group { flex-direction: column !important; gap: 10px !important; } }
@media (max-width: 768px) { .po-section, .form-section { grid-template-columns: 1fr !important; } }
@media (max-width: 768px) { table { display: block !important; overflow-x: auto !important; white-space: nowrap !important; } }

/* Global font size reduction */
body {
    font-size: 13.5px !important;
}

/* Compact Tables */
table th, table td, .history-table th, .history-table td {
    padding: 6px 10px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
}

/* Make action buttons in tables smaller and compact */
table td .btn {
    padding: 4px 8px !important;
    font-size: 12px !important;
    margin: 2px !important;
}

/* Ensure mobile swipe works flawlessly for all tables */
@media (max-width: 768px) {
    table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important; /* Smooth scrolling on iOS */
        border-right: 1px solid #e2e8f0 !important;
    }
}

/* Make action buttons in tables extremely compact */
.action-btn {
    font-size: 13.5px !important;
    margin: 0 3px !important;
    padding: 2px !important;
}

table td {
    vertical-align: middle !important;
}

/* Ensure inputs inside tables (like bulk edit) are also compact */
table input, table select {
    padding: 4px 6px !important;
    font-size: 13px !important;
    height: auto !important;
}
