:root {
    --primary: #0B4FB5;
    --secondary: #39A8E8;
    --gold: #FFC107;
    --dark: #09203a;
    --light: #f4f7fb;
    --success: #28a745;
    --danger: #dc3545;
    --white: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--light);
    color: #333;
}

/* LOGIN LAYOUT */
.login-body {
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: #ffffff;
    border: 1px solid #eef2f6;
    border-radius: 20px;
    width: 100%;
    max-width: 450px;
    padding: 40px;
    color: #333333;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

.login-card h2 {
    font-size: 28px;
    margin-bottom: 10px;
    text-align: center;
    color: var(--primary);
}

.login-card p {
    text-align: center;
    margin-bottom: 30px;
    color: #64748b;
    font-size: 14px;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.login-card .form-control {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #333333;
    font-size: 15px;
    outline: none;
    transition: 0.3s;
}

.login-card .form-control:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 8px rgba(11, 79, 181, 0.15);
}

.login-card .btn-submit {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    transition: 0.3s;
}

.login-card .btn-submit:hover {
    background: #093f91;
    transform: translateY(-2px);
}

.login-card .error-box {
    background: rgba(220, 53, 69, 0.1);
    border-left: 4px solid var(--danger);
    color: var(--danger);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ADMIN PANEL LAYOUT */
.admin-navbar {
    background: var(--dark);
    color: var(--white);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-logo h2 {
    color: var(--gold);
    font-size: 22px;
    font-weight: 800;
}

.admin-logo span {
    color: var(--white);
    font-size: 12px;
    font-weight: 400;
}

.admin-nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.admin-nav-actions a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    transition: 0.3s;
}

.admin-nav-actions a:hover {
    color: var(--gold);
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--white);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.3s;
}

.btn-logout:hover {
    background: var(--danger);
    border-color: var(--danger);
}

/* MAIN CONTENT */
.admin-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.admin-header h1 {
    font-size: 28px;
    color: var(--dark);
}

/* METRIC CARDS */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.metric-card {
    background: var(--white);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 5px solid var(--primary);
}

.metric-card.metrics-products {
    border-left-color: var(--secondary);
}

.metric-card.metrics-messages {
    border-left-color: var(--gold);
}

.metric-info h3 {
    font-size: 14px;
    color: #777;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.metric-info p {
    font-size: 32px;
    font-weight: 800;
    color: var(--dark);
}

.metric-icon {
    font-size: 36px;
    color: rgba(0,0,0,0.1);
}

/* DASHBOARD TABLES & CARDS */
.dashboard-section {
    background: var(--white);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    margin-bottom: 40px;
}

.dashboard-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--light);
    padding-bottom: 15px;
}

.dashboard-section-header h2 {
    font-size: 20px;
    color: var(--dark);
}

/* BUTTONS */
.btn-action {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: #093f91;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
}

.btn-edit {
    background: var(--secondary);
    color: var(--white);
    border: none;
}

.btn-edit:hover {
    background: #258fcb;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    border: none;
}

.btn-danger:hover {
    background: #bd2130;
}

.btn-back {
    background: #6c757d;
    color: var(--white);
    border: none;
}

.btn-back:hover {
    background: #5a6268;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th {
    background: var(--light);
    color: var(--dark);
    text-align: left;
    padding: 12px 15px;
    font-weight: 600;
    font-size: 14px;
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--light);
    font-size: 14px;
    vertical-align: middle;
}

tr:hover td {
    background-color: rgba(57, 168, 232, 0.03);
}

.badge-table {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-blue {
    background: rgba(11, 79, 181, 0.1);
    color: var(--primary);
}

.badge-gold {
    background: rgba(255, 193, 7, 0.15);
    color: #b58000;
}

.product-img-th {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 6px;
}

/* FORMS FOR CRUD */
.admin-form {
    max-width: 700px;
    margin: 0 auto;
}

.form-card {
    background: var(--white);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
    font-size: 14px;
}

.form-card .form-control {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #ced4da;
    font-size: 15px;
    outline: none;
    transition: 0.3s;
    background: #fff;
    color: #333;
}

.form-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(11, 79, 181, 0.2);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* SUCCESS ALERT */
.alert-success {
    background: rgba(40, 167, 69, 0.15);
    border-left: 5px solid var(--success);
    color: #1e5529;
    padding: 15px 20px;
    font-weight: 500;
}

/* DATATABLES CUSTOM INTEGRATION */
.dataTables_wrapper {
    margin-top: 15px;
    padding: 10px;
    font-family: inherit;
}
.dataTables_wrapper::after {
    content: "";
    clear: both;
    display: table;
}
.dataTables_wrapper .dataTables_filter {
    float: right;
    margin-bottom: 20px !important;
}
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 8px 14px !important;
    background-color: #f8fafc !important;
    outline: none !important;
    font-size: 13.5px !important;
    color: #333 !important;
    margin-left: 8px !important;
    width: 250px !important;
    transition: 0.3s !important;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(11, 79, 181, 0.15) !important;
    background-color: #ffffff !important;
}
.dataTables_wrapper .dataTables_length {
    float: left;
    margin-bottom: 20px !important;
    font-size: 14px !important;
    color: #64748b !important;
}
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 6px 24px 6px 12px !important;
    background-color: #f8fafc !important;
    outline: none !important;
    font-size: 13.5px !important;
    color: #333 !important;
}
.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--primary) !important;
}
.dataTables_wrapper .dataTables_info {
    float: left;
    margin-top: 15px !important;
    font-size: 13.5px !important;
    color: #64748b !important;
}
.dataTables_wrapper .dataTables_paginate {
    float: right;
    margin-top: 15px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 6px 12px !important;
    border-radius: 6px !important;
    border: 1px solid #cbd5e1 !important;
    margin: 0 2px !important;
    font-size: 13px !important;
    background: #f8fafc !important;
    color: #333 !important;
    transition: 0.3s !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current, 
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #eef2f6 !important;
    color: #333 !important;
    border-color: #cbd5e1 !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: #f1f5f9 !important;
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
    cursor: not-allowed !important;
}
.dataTables_wrapper table.dataTable {
    border-collapse: collapse !important;
    width: 100% !important;
    margin-bottom: 20px !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
.dataTables_wrapper table.dataTable thead th {
    border-bottom: 2px solid #cbd5e1 !important;
    padding: 14px 12px !important;
    font-weight: 600 !important;
}
.dataTables_wrapper table.dataTable tbody td {
    padding: 14px 12px !important;
    vertical-align: middle !important;
}

/* Tablet & Mobile responsive toolbar layouts */
@media (max-width: 768px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none !important;
        text-align: center !important;
        width: 100% !important;
        display: block !important;
        margin: 10px 0 !important;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 5px !important;
        box-sizing: border-box !important;
    }
    
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        display: inline-block !important;
        margin: 2px !important;
        padding: 4px 10px !important;
    }
}

/* Responsive Table styling for arrow controls and details */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
    padding-left: 30px !important;
    position: relative;
    cursor: pointer;
}

table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control::before {
    content: "▶" !important;
    background-color: transparent !important;
    color: #4a5568 !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 11px !important;
    line-height: 1 !important;
    height: auto !important;
    width: auto !important;
    display: inline-block !important;
    position: absolute !important;
    left: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    transition: transform 0.15s ease-in-out;
}

table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control::before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control::before {
    content: "▼" !important;
    color: #1a202c !important;
}

/* Style child row container details */
table.dataTable > tbody > tr.child {
    background: #f8fafc !important;
}
table.dataTable > tbody > tr.child:hover td {
    background: #f8fafc !important;
}
table.dataTable > tbody > tr.child ul.dtr-details {
    display: block !important;
    width: 100% !important;
    list-style-type: none !important;
    padding: 15px !important;
    margin: 5px 0 !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 2px 4px -1px rgba(0,0,0,0.01) !important;
}
table.dataTable > tbody > tr.child ul.dtr-details > li {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    font-size: 13.5px !important;
}
table.dataTable > tbody > tr.child ul.dtr-details > li:last-child {
    border-bottom: none !important;
}
table.dataTable > tbody > tr.child ul.dtr-details > li > span.dtr-title {
    font-weight: 600 !important;
    color: #475569 !important;
    min-width: 150px !important;
    display: inline-block !important;
    margin-right: 15px !important;
}
table.dataTable > tbody > tr.child ul.dtr-details > li > span.dtr-data {
    color: #1e293b !important;
    display: inline-block !important;
}

/* SIDEBAR NAVIGATION LAYOUT */
.sidebar-link {
    transition: 0.3s;
}
.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white !important;
}
.sidebar-link.active {
    background: var(--primary) !important;
    color: white !important;
}
.btn-logout-sidebar:hover {
    background: rgba(220, 53, 69, 0.08) !important;
    color: #dc3545 !important;
}

@media (max-width: 992px) {
    body, html {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    .admin-layout {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    .admin-mobile-header {
        display: flex !important;
    }
    .admin-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease !important;
        display: flex !important;
        z-index: 1050 !important;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.3) !important;
    }
    .admin-sidebar.active {
        transform: translateX(0) !important;
    }
    #sidebarClose {
        display: block !important;
    }
    #sidebarOverlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        backdrop-filter: blur(2px);
    }
    .admin-main {
        margin-left: 0 !important;
        padding: 95px 20px 30px 20px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .mobile-menu-link {
        display: block !important;
        text-align: center !important;
        padding: 12px 15px !important;
        color: #333 !important;
        text-decoration: none !important;
        font-weight: 600 !important;
        font-size: 15px !important;
        border-radius: 8px !important;
        transition: 0.2s !important;
    }
    .mobile-menu-link:hover,
    .mobile-menu-link.active {
        background: #f4f7fb !important;
        color: #0B4FB5 !important;
    }
}

/* Extra small mobile adjustments to keep everything perfectly scaled and visible */
@media (max-width: 480px) {
    .admin-mobile-header {
        height: 65px !important;
        padding: 10px 12px !important;
    }
    .admin-mobile-header img {
        width: 36px !important;
        height: 36px !important;
    }
    .admin-mobile-header h2 {
        font-size: 13px !important;
    }
    .admin-mobile-header span {
        font-size: 8.5px !important;
    }
    #mobileNavToggle {
        width: 35px !important;
        height: 35px !important;
        font-size: 18px !important;
    }
    .admin-main {
        padding-top: 85px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    #mobileDropdownMenu {
        top: 65px !important;
        padding: 15px 12px !important;
        max-height: calc(100vh - 65px) !important;
    }
}

/* Zoomable Image Thumbnails & Overlays */
.zoomable-image-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    display: inline-block;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease-in-out;
}

.zoomable-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.zoomable-image-container:hover img {
    transform: scale(1.1);
}

.zoomable-image-container .zoom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 32, 58, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.zoomable-image-container:hover .zoom-overlay {
    opacity: 1;
}

.zoomable-image-container .zoom-overlay i {
    color: #fff;
    font-size: 16px;
    transform: scale(0.8);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.zoomable-image-container:hover .zoom-overlay i {
    transform: scale(1);
}

/* Premium Global Lightbox Zoom Modal */
.global-zoom-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(9, 32, 58, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.global-zoom-modal.active {
    display: flex !important;
    opacity: 1;
}

.global-zoom-close {
    position: absolute;
    top: 25px;
    right: 25px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 32px;
    background: rgba(255, 255, 255, 0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100001;
}

.global-zoom-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.global-zoom-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    background: rgba(255, 255, 255, 0.1);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100000;
}

.global-zoom-nav:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.05);
}

.global-zoom-prev {
    left: 40px;
}

.global-zoom-next {
    right: 40px;
}

.global-zoom-wrapper {
    position: relative;
    max-width: 85%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.global-zoom-content {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.global-zoom-modal.active .global-zoom-content {
    transform: scale(1);
    opacity: 1;
}

.global-zoom-caption {
    margin-top: 15px;
    color: #f8fafc;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    background: rgba(9, 32, 58, 0.6);
    padding: 8px 20px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 600px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease 0.1s;
}

.global-zoom-modal.active .global-zoom-caption {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .global-zoom-nav {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    .global-zoom-prev {
        left: 15px;
    }
    .global-zoom-next {
        right: 15px;
    }
    .global-zoom-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
}

