/* Import Google Fonts - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-color-glow: rgba(13, 148, 136, 0.3);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Login Page Theme Colors */
    --grad-start: #047857;
    --grad-middle: #0d9488;
    --grad-end: #0369a1;
    --grad-login: linear-gradient(135deg, #047857 0%, #0d9488 60%, #0369a1 100%);

    --color-primary: #047857;
    --color-primary-glow: rgba(4, 120, 87, 0.08);
    --color-accent: #0d9488;
    --color-success: #0d9488;
    --color-warning: #ea580c;
    --color-danger: #dc2626;
    --color-info: #0369a1;

    --font-sans: 'Poppins', sans-serif;
    --font-heading: 'Poppins', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03), 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 15px rgba(13, 148, 136, 0.15);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    transition: var(--transition-smooth);
}

/* Subtler Green Background Gradients */
body::before {
    content: "";
    position: fixed;
    top: -10%;
    left: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(4, 120, 87, 0.04) 0%, rgba(255,255,255,0) 70%);
    z-index: -1;
    pointer-events: none;
}
body::after {
    content: "";
    position: fixed;
    bottom: -10%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(13, 148, 136, 0.03) 0%, rgba(255,255,255,0) 70%);
    z-index: -1;
    pointer-events: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar styling - Premium Dark Green theme with White active menu highlights */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #047857 0%, #0d9488 60%, #0369a1 100%);
    border-right: none;
    padding: 1.25rem 0.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition-smooth);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
}

.brand-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem 0.5rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    position: relative;
}

.brand-icon {
    font-size: 1.5rem;
    background: #ffffff;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
}

.brand-subtitle {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary) !important;
    text-align: center;
    line-height: 1.3;
    letter-spacing: 0.02em;
}

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    cursor: pointer;
    font-size: 0.85rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: auto;
    transition: var(--transition-smooth);
}
.sidebar-toggle-btn:hover {
    background: #ffffff;
    color: #047857;
    border-color: #ffffff;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.menu-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.55);
    margin: 0.6rem 0.25rem 0.2rem 0.25rem;
    font-weight: 700;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.55rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.menu-item a i {
    width: 18px;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.7);
}

.menu-item a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}
.menu-item a:hover i {
    color: #ffffff;
}

.menu-item.active > a {
    color: #047857 !important;
    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.menu-item.active > a i {
    color: #047857 !important;
}

/* Sidebar Dropdown/Submenu */
.sidebar-menu .has-submenu {
    display: flex;
    flex-direction: column;
}
.sidebar-menu .submenu {
    list-style: none;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.25rem;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    margin-left: 1.4rem;
}
.sidebar-menu .submenu-arrow {
    margin-left: auto;
    font-size: 0.8rem;
    transition: var(--transition-smooth);
}
.sidebar-menu .has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #047857 !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
}

.user-info {
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: capitalize;
}

/* Sidebar Collapsed State (Desktop Toggle) */
/* Sidebar Collapsed State (Desktop Toggle) - Desktop only */
@media (min-width: 769px) {
    body.sidebar-collapsed .sidebar {
        width: 70px;
        padding: 1.5rem 0;
        align-items: center;
    }
    body.sidebar-collapsed .brand-name,
    body.sidebar-collapsed .brand-subtitle,
    body.sidebar-collapsed .user-info,
    body.sidebar-collapsed .submenu-arrow {
        display: none !important;
    }
    body.sidebar-collapsed .menu-label,
    body.sidebar-collapsed span.menu-label {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }
    body.sidebar-collapsed .menu-item span {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
    body.sidebar-collapsed .brand-section {
        background: #ffffff;
        border-radius: 50% !important;
        width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        margin: 0 auto 0.6rem auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    }
    body.sidebar-collapsed .brand-section img {
        max-height: 20px !important;
        max-width: 32px !important;
        width: auto;
        height: auto;
        object-fit: contain;
    }
    body.sidebar-collapsed .sidebar-menu {
        width: 100%;
        padding: 0 0.5rem;
        overflow-x: hidden;
        scrollbar-width: none;
    }
    body.sidebar-collapsed .sidebar-menu::-webkit-scrollbar {
        display: none;
    }
    body.sidebar-collapsed .menu-item {
        width: 100%;
        display: flex;
        justify-content: center;
    }
    body.sidebar-collapsed .menu-item a {
        width: 44px;
        height: 44px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
        margin: 0.15rem auto;
        transition: var(--transition-smooth);
    }
    body.sidebar-collapsed .menu-item a i {
        margin: 0;
        font-size: 1.2rem;
        width: auto;
    }
    body.sidebar-collapsed .sidebar-menu .submenu {
        display: none !important; /* Hide submenus when collapsed */
    }
    body.sidebar-collapsed .main-wrapper {
        margin-left: 70px;
    }
}

/* Main Content Layout */
.main-wrapper {
    flex-grow: 1;
    margin-left: 280px;
    padding: 2.25rem 2.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
    min-width: 0;
}

/* Header Area */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.header-title h1 {
    font-size: 1.75rem;
    color: var(--text-primary);
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Clean Cards */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);
    margin-bottom: 2rem;
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(13, 148, 136, 0.25);
    box-shadow: 0 15px 35px -10px rgba(15, 23, 42, 0.06), 0 0 15px rgba(13, 148, 136, 0.05);
}

/* Premium Dashboard Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.25rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 25px -10px rgba(15, 23, 42, 0.03), 0 1px 2px rgba(15, 23, 42, 0.01);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.metric-card:hover {
    transform: translateY(-4px);
    border-color: rgba(13, 148, 136, 0.25);
    box-shadow: 0 20px 35px -15px rgba(15, 23, 42, 0.08), 0 10px 20px -10px rgba(13, 148, 136, 0.04);
}

.metric-card::before {
    content: "";
    position: absolute;
    top: 15%;
    left: 0;
    width: 6px;
    height: 70%;
    border-radius: 0 4px 4px 0;
    background: var(--color-primary);
    transition: var(--transition-smooth);
}

.metric-card.success::before { background: var(--color-success); }
.metric-card.warning::before { background: var(--color-warning); }
.metric-card.danger::before { background: var(--color-danger); }
.metric-card.accent::before { background: var(--color-accent); }

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

.metric-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.metric-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: var(--color-primary);
    transition: var(--transition-smooth);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.metric-card.success .metric-icon-box { background: #f0fdf4; color: var(--color-success); border-color: rgba(13, 148, 136, 0.1); }
.metric-card.warning .metric-icon-box { background: #fff7ed; color: var(--color-warning); border-color: rgba(234, 88, 12, 0.1); }
.metric-card.danger .metric-icon-box { background: #fef2f2; color: var(--color-danger); border-color: rgba(220, 38, 38, 0.1); }
.metric-card.accent .metric-icon-box { background: #ecfdf5; color: var(--color-accent); border-color: rgba(4, 120, 87, 0.1); }

.metric-card:hover .metric-icon-box {
    transform: scale(1.05) rotate(3deg);
}

.metric-card.success:hover .metric-icon-box { background: var(--grad-login); color: white; border-color: transparent; }
.metric-card.warning:hover .metric-icon-box { background: linear-gradient(135deg, var(--color-warning) 0%, #c2410c 100%); color: white; border-color: transparent; }
.metric-card.danger:hover .metric-icon-box { background: linear-gradient(135deg, var(--color-danger) 0%, #b91c1c 100%); color: white; border-color: transparent; }
.metric-card.accent:hover .metric-icon-box { background: var(--grad-login); color: white; border-color: transparent; }

/* Buttons styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-primary {
    background: var(--grad-login);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 4px 18px rgba(13, 148, 136, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: #f8fafc;
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger) 0%, #b91c1c 100%);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
    box-shadow: 0 4px 18px rgba(220, 38, 38, 0.3);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--grad-login);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.2);
}

.btn-success:hover {
    box-shadow: 0 4px 18px rgba(13, 148, 136, 0.3);
    transform: translateY(-1px);
}

.btn-icon-only {
    padding: 0.45rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* Premium Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table-premium {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.table-premium th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    padding: 0.85rem 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-premium td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.table-premium tbody tr:hover td {
    background: rgba(13, 148, 136, 0.03); /* Soft teal-green tint on hover */
    color: var(--text-primary);
}

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

/* Badges & Tags */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 9999px;
    letter-spacing: 0.02em;
}

.badge-low {
    background: #f0fdf4;
    color: var(--color-primary);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.badge-medium {
    background: #fff7ed;
    color: var(--color-warning);
    border: 1px solid rgba(234, 88, 12, 0.2);
}

.badge-high {
    background: #fef2f2;
    color: var(--color-danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

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

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    letter-spacing: 0.02em;
}

.form-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

select.form-control {
    cursor: pointer;
}

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

/* Flash Messages */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-success {
    background: #f0fdf4;
    border-color: rgba(22, 163, 74, 0.15);
    color: var(--color-accent);
}

.alert-danger {
    background: #fef2f2;
    border-color: rgba(220, 38, 38, 0.15);
    color: var(--color-danger);
}

/* Pagination */
.pagination {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    margin-top: 1.25rem;
    justify-content: center;
}

.pagination li a, .pagination li span {
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.pagination li a:hover {
    background: #f8fafc;
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.pagination li.active span {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* Login Page Layout */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1.5rem;
    background-color: var(--bg-primary);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-top: 0.5rem;
}

/* ── Top Bar ── */
.top-bar {
    /* stretch edge-to-edge, compensating for main-wrapper padding */
    margin: -2.25rem -2.5rem 2rem -2.5rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Hamburger button inside top bar */
.top-bar-hamburger {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}
.top-bar-hamburger:hover {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

/* Breadcrumb */
.top-bar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.top-bar-system {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
}
.top-bar-page {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary);
}

/* User block on the right */
.top-bar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.top-bar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #047857 0%, #0d9488 60%, #0369a1 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.25) !important;
}
.top-bar-userinfo {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.top-bar-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}
.top-bar-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Logout button in top bar */
.top-bar-logout {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(220, 38, 38, 0.15);
    border-radius: 8px;
    background: rgba(220, 38, 38, 0.04);
    color: var(--color-danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    text-decoration: none;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}
.top-bar-logout:hover {
    background: var(--color-danger);
    color: #ffffff;
    border-color: var(--color-danger);
}

/* Hide breadcrumb text on very small screens */
@media (max-width: 480px) {
    .top-bar-breadcrumb { display: none; }
    .top-bar-userinfo   { display: none; }
    .top-bar {
        margin: -1.5rem -1.5rem 1.5rem -1.5rem;
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    .top-bar {
        margin: -1.5rem -1.5rem 1.5rem -1.5rem;
        padding: 0 1.5rem;
    }
}

/* Action Bars for Lists */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Detail Views */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.detail-item {
    margin-bottom: 0.75rem;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Engine Status Widget */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: relative;
}

.status-dot.online {
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

.status-dot.online::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    border: 2px solid var(--color-success);
    animation: pulse 1.5s infinite;
}

.status-dot.offline {
    background-color: var(--color-danger);
    box-shadow: 0 0 8px var(--color-danger);
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Responsiveness and Mobile Views */
@media (max-width: 768px) {
    .mobile-toggle-btn {
        display: flex;
    }
    
    .sidebar {
        left: -280px;
        box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    }
    
    body.sidebar-open .sidebar {
        left: 0;
    }
    
    .main-wrapper {
        margin-left: 0 !important;
        padding: 1.5rem !important;
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .main-header .btn {
        width: 100%;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* Printing Specific styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .sidebar, .main-header, .action-bar, .btn, .pagination, .no-print, .mobile-toggle-btn {
        display: none !important;
    }
    
    .main-wrapper {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .glass-card {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    
    .table-premium {
        border: 1px solid #000 !important;
    }
    
    .table-premium th {
        background: #f1f5f9 !important;
        color: black !important;
        border-bottom: 2px solid #000 !important;
        padding: 6px !important;
    }
    
    .table-premium td {
        color: black !important;
        border-bottom: 1px solid #e2e8f0 !important;
        padding: 6px !important;
    }
    
    .badge {
        background: transparent !important;
        color: black !important;
        border: 1px solid #000 !important;
        padding: 0 4px !important;
    }
}

/* Bootstrap Overrides to match Login Theme */
.btn-primary {
    background: var(--grad-login) !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.2) !important;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: linear-gradient(135deg, #0369a1 0%, #047857 100%) !important;
    box-shadow: 0 4px 18px rgba(13, 148, 136, 0.3) !important;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--grad-login) !important;
    border: none !important;
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger) 0%, #b91c1c 100%) !important;
    border: none !important;
}

.btn-secondary {
    background-color: #64748b !important;
    border-color: #64748b !important;
    color: #ffffff !important;
}

.btn-secondary:hover {
    background-color: #475569 !important;
    border-color: #475569 !important;
}

.page-item.active .page-link {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #ffffff !important;
}

.page-link {
    color: var(--color-primary) !important;
}

.page-link:hover {
    background-color: var(--color-primary-glow) !important;
}

.modal-header.bg-success {
    background: var(--grad-login) !important;
}
.modal-header.bg-success .modal-title {
    color: #ffffff !important;
}

/* Card header with gradient (for create/edit forms) */
.card-header-grad {
    background: var(--grad-login) !important;
    color: #ffffff !important;
    border-bottom: none !important;
    border-radius: 0.5rem 0.5rem 0 0 !important;
}
.card-header-grad h1,
.card-header-grad h2,
.card-header-grad h3,
.card-header-grad h4,
.card-header-grad h5 {
    color: #ffffff !important;
    margin-bottom: 0;
    font-weight: 700;
}

/* Custom icon buttons */
.btn-icon-only {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border-radius: 8px !important;
}

/* Modern DataTables Premium Styling */
.dataTables_wrapper {
    width: 100%;
}

/* Padding for top controls row (length + search) */
.dataTables_wrapper > .row:first-child {
    padding: 1.25rem 1.5rem 1rem 1.5rem;
    margin-left: 0 !important;
    margin-right: 0 !important;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: #f8fafc;
}

/* Padding for bottom controls row (info + pagination) */
.dataTables_wrapper > .row:last-child {
    padding: 1rem 1.5rem 1.25rem 1.5rem;
    margin-left: 0 !important;
    margin-right: 0 !important;
    align-items: center;
    border-top: 1px solid var(--border-color);
    background-color: #f8fafc;
}

/* Remove margin between table container row and controls */
.dataTables_wrapper > .row:nth-child(2) {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Adjust table responsive wrapper border */
.dataTables_wrapper .table-responsive {
    border: none !important;
    margin: 0 !important;
}

/* Style length select and search input */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 0.45rem 1rem !important;
    font-size: 0.85rem !important;
    color: var(--text-primary) !important;
    background-color: #ffffff !important;
    transition: var(--transition-smooth) !important;
    margin-left: 0.5rem !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02) !important;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none !important;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px var(--color-primary-glow) !important;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 0.4rem 2rem 0.4rem 0.75rem !important;
    font-size: 0.85rem !important;
    color: var(--text-primary) !important;
    background-color: #ffffff !important;
    transition: var(--transition-smooth) !important;
    cursor: pointer !important;
    margin: 0 0.25rem !important;
}

.dataTables_wrapper .dataTables_length select:focus {
    outline: none !important;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px var(--color-primary-glow) !important;
}

/* Info text style */
.dataTables_wrapper .dataTables_info {
    font-size: 0.85rem !important;
    color: var(--text-secondary) !important;
    font-weight: 500 !important;
    padding-top: 0 !important;
}

/* Pagination buttons styling */
.dataTables_wrapper .pagination {
    margin-bottom: 0 !important;
    gap: 0.15rem !important;
}

.dataTables_wrapper .page-item .page-link {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.85rem !important;
    border-radius: 6px !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    font-weight: 500 !important;
    background-color: #ffffff !important;
    transition: var(--transition-smooth) !important;
}

.dataTables_wrapper .page-item:first-child .page-link,
.dataTables_wrapper .page-item:last-child .page-link {
    border-radius: 8px !important;
}

.dataTables_wrapper .page-item.active .page-link {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%) !important;
    border-color: var(--color-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.15) !important;
}

.dataTables_wrapper .page-item.disabled .page-link {
    background-color: #f8fafc !important;
    border-color: var(--border-color) !important;
    color: var(--text-muted) !important;
}

.dataTables_wrapper .page-item:not(.active):not(.disabled) .page-link:hover {
    background-color: #f0fdf4 !important;
    color: var(--color-primary) !important;
    border-color: rgba(22, 163, 74, 0.25) !important;
}

/* Header sorting icons spacing and position adjustment */
table.dataTable thead > tr > th.sorting,
table.dataTable thead > tr > th.sorting_asc,
table.dataTable thead > tr > th.sorting_desc {
    padding-right: 30px !important;
}

/* Make table look clean and modern */
table.dataTable {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

table.dataTable thead th {
    border-bottom: 1px solid var(--border-color) !important;
    background-color: #f8fafc !important;
    padding: 1rem 0.75rem !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

table.dataTable tbody td {
    padding: 1rem 0.75rem !important;
    border-bottom: 1px solid var(--border-color) !important;
}

/* Responsive fixes for mobile screen widths */
@media (max-width: 576px) {
    .dataTables_wrapper > .row:first-child {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
        padding: 1rem !important;
    }
    .dataTables_wrapper .dataTables_filter {
        text-align: left !important;
    }
    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 0.25rem !important;
    }
    .dataTables_wrapper .dataTables_length label {
        width: 100%;
        justify-content: space-between;
    }
    .dataTables_wrapper > .row:last-child {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
        text-align: center;
        padding: 1rem !important;
    }
}
