@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* MSJK Digital Services Brand Palette */
    --primary: #F37021; /* Vibrant Orange */
    --primary-hover: #E06015; /* Darker Orange */
    --sidebar-bg: #003893; /* Royal Blue */
    --sidebar-text: #ECEFF1; /* Muted Highlight */
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active-text: #ffffff;
    --background: #f4f7f6; /* Clean subtle gray */
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    
    /* Gradients for Stat Cards (Strict Logo Palette) */
    --grad-blue: linear-gradient(135deg, #003893 0%, #002266 100%); /* Brand Blue */
    --grad-orange: linear-gradient(135deg, #F37021 0%, #E06015 100%); /* Brand Orange */
    --grad-green: linear-gradient(135deg, #009639 0%, #00702A 100%); /* Brand Green */
    --grad-dark-blue: linear-gradient(135deg, #002266 0%, #001133 100%); /* Deep Blue */
    --grad-dark-orange: linear-gradient(135deg, #E06015 0%, #A64009 100%); /* Deep Orange */

    /* Shadows & Borders */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 10px;
    --border-color: #e5e7eb;
}

/* Global Reset & Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1; 
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 0;
    padding: 160px 30px 30px 30px; /* Increased top padding to prevent fixed navbar from overlapping page titles */
    width: 100%;
}

/* Top Navbar */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: transparent;
    z-index: 110;
    display: flex;
    flex-direction: column;
}

.topbar-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    height: 70px;
    width: 100%;
    background: var(--sidebar-bg);
}

.brand {
    display: flex;
    align-items: center;
    margin: 0;
    background: #ffffff; /* White background to make dark blue logo visible */
    padding: 6px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.brand-logo {
    height: 40px; /* Perfect height to fit within 70px header */
    width: auto;
    object-fit: contain;
}

/* Horizontal Navigation */
.horizontal-nav {
    width: 100%;
    background-color: var(--card-bg); /* White background */
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-bottom: 1px solid var(--border-color);
}

.nav-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}



.horizontal-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 15px;
    margin: 0;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #cbd5e1 transparent; /* Firefox thumb and track */
    scroll-behavior: smooth; /* Smooth panning */
    flex: 1;
    padding-bottom: 5px; /* Add slight padding so scrollbar doesn't overlap links */
}

/* Custom Scrollbar for Chrome/Safari/Edge */
.horizontal-nav ul::-webkit-scrollbar {
    height: 6px; /* Thin horizontal scrollbar */
    display: block; 
}

.horizontal-nav ul::-webkit-scrollbar-track {
    background: transparent; 
}

.horizontal-nav ul::-webkit-scrollbar-thumb {
    background: #cbd5e1; /* Muted gray thumb */
    border-radius: 10px;
}

.horizontal-nav ul::-webkit-scrollbar-thumb:hover {
    background: var(--primary); /* Saffron on hover */
}

.horizontal-nav a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-main); /* Dark gray text */
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.horizontal-nav a i {
    margin-right: 8px;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.horizontal-nav a:hover, .horizontal-nav li.active a {
    background-color: #f9fafb; /* Subtle hover */
    color: var(--primary); /* Saffron Accent */
    border-bottom-color: var(--primary);
}

.horizontal-nav a:hover i {
    transform: translateY(-2px);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 20px;
    border-right: 1px solid rgba(255,255,255,0.2); /* Semi-transparent border on dark background */
}

.user-profile .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary); /* Saffron Avatar */
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff; /* White text on dark bar */
    line-height: 1.2;
}

.user-role {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 5px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    text-align: center;
    letter-spacing: 0.5px;
}

.role-admin { background-color: var(--primary); color: white; }
.role-super { background-color: var(--primary); color: white; }

.logout-top {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: var(--sidebar-text); /* Muted #ECEFF1 */
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: color 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.logout-top:hover {
    color: #ffffff; /* Brighter white on hover */
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 5px;
}

.page-title i {
    color: var(--sidebar-bg); /* Royal Blue for title icons */
    margin-right: 8px;
}

/* Stat Cards (Dashboard) */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.color-block {
    padding: 20px;
    border-radius: var(--border-radius);
    color: white;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.color-block:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.color-block::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.bg-blue { background: var(--grad-blue); }
.bg-orange { background: var(--grad-orange); }
.bg-green { background: var(--grad-green); }
.bg-dark-blue { background: var(--grad-dark-blue); }
.bg-dark-orange { background: var(--grad-dark-orange); }

.color-block .title {
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 10px;
}

.color-block .amount {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Panels */
.panel {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f9fafb;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    font-size: 0.95rem;
}

tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: #f3f4f6;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(243, 112, 33, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(243, 112, 33, 0.3); }

.btn-success { background: #009639; color: white; }
.btn-success:hover { background: #00702A; box-shadow: 0 4px 12px rgba(0, 150, 57, 0.3); }

.btn-warning { background: #f59e0b; color: white; }
.btn-warning:hover { background: #d97706; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }

.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* Utility Colors */
.text-blue { color: var(--sidebar-bg); }
.text-green { color: #009639; }
.text-orange { color: var(--primary); }
.text-dark-blue { color: #002266; }

/* Dashboard Chart Container */
.chart-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 25px;
}

/* Authentication Pages */
.auth-wrapper {
    min-height: 100vh;
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-bg); /* Royal Blue */
    padding: 20px;
}

.auth-card {
    background: #ffffff;
    width: 100%;
    max-width: 420px;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    padding: 40px 50px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.auth-logo img {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.auth-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Authentication Page Form Overrides */
.auth-wrapper .form-control {
    background-color: #ECEFF1; /* Muted Highlight (Slate Gray) */
    border: 1px solid transparent;
    color: var(--text-main);
}

.auth-wrapper .form-control:focus {
    background-color: #ffffff;
    border-color: var(--sidebar-bg);
    box-shadow: 0 0 0 3px rgba(0, 56, 147, 0.1);
}

/* Authentication Page Button Overrides */
.auth-wrapper .btn-primary {
    background-color: var(--primary);
    color: white;
}

.auth-wrapper .btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(243, 112, 33, 0.3);
}

.auth-footer {
    margin-top: 25px;
    text-align: center;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-footer p {
    margin: 0;
}

.auth-footer a {
    color: var(--sidebar-bg);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
    color: var(--primary);
}

/* W-Full button */
.w-full {
    width: 100%;
    justify-content: center;
}
