/* CloudX Admin Dashboard - Zimbra-Style Custom Styles */

:root {
    /* Zimbra Admin Console - Serenity Theme Colors */
    --sidebar-width: 250px;
    --navbar-height: 48px;

    /* Zimbra Color Palette */
    --zimbra-app-color: #0D3E6F;           /* AppColor - Zimbra blue */
    --zimbra-selection: #C1DFFE;           /* SelColor - light blue selection */
    --zimbra-accent: #0095D3;              /* Accent blue */
    --zimbra-text: #333333;                /* Text color - dark gray */

    /* Header colors (blue gradient - classic Zimbra) */
    --zimbra-header-bg: #0D3E6F;
    --zimbra-header-border: #092D52;

    /* Sidebar/Tree navigation - left panel */
    --zimbra-sidebar-bg: #F7F7F7;          /* Light gray background */
    --zimbra-sidebar-border: #DCDCDC;
    --zimbra-sidebar-hover: #E8E8E8;
    --zimbra-sidebar-active: #C1DFFE;       /* Selection blue */
    --zimbra-sidebar-text: #333333;
    --zimbra-sidebar-text-active: #333333;

    /* Content area */
    --zimbra-content-bg: #FFFFFF;
    --zimbra-toolbar-bg: #F5F5F5;
    --zimbra-border: #DCDCDC;

    /* Buttons and links */
    --zimbra-btn-primary: #0095D3;
    --zimbra-btn-primary-hover: #007BB8;
    --zimbra-link: #0095D3;

    /* Legacy variables for compatibility */
    --primary-color: #0095D3;
    --sidebar-bg: #F7F7F7;
    --sidebar-text: #333333;
}

/* Body and Layout */
body {
    font-family: Arial, sans-serif;
    font-size: 12px;
    background-color: var(--zimbra-content-bg);
    color: var(--zimbra-text);
}

/* Navbar - Zimbra Style */
.navbar {
    z-index: 1030;
}

.za-navbar {
    background: linear-gradient(180deg, #1565C0 0%, var(--zimbra-app-color) 100%) !important;
    height: var(--navbar-height);
    padding: 0 16px;
    border-bottom: 1px solid var(--zimbra-header-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.za-navbar .navbar-brand {
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.za-navbar .navbar-brand i {
    font-size: 22px;
    color: #FFFFFF;
}

.za-navbar .nav-link {
    color: rgba(255,255,255,0.9) !important;
    font-size: 13px;
    padding: 8px 16px;
}

.za-navbar .nav-link:hover {
    color: #FFFFFF !important;
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

.za-navbar .dropdown-menu {
    background: #fff;
    border: 1px solid var(--zimbra-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
}

.za-navbar .dropdown-item {
    color: var(--zimbra-text);
    padding: 10px 16px;
    font-size: 13px;
}

.za-navbar .dropdown-item:hover {
    background: var(--zimbra-selection);
    color: var(--zimbra-text);
}

.za-navbar .dropdown-item i {
    margin-right: 10px;
    color: #666;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    z-index: 1020;
}

.sidebar-header {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.75rem 1rem;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.05);
}

.sidebar .nav-link.active {
    color: #fff;
    background-color: rgba(43, 87, 154, 0.3);
    border-left-color: var(--zimbra-blue);
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-top: var(--navbar-height);
    padding: 2rem;
    min-height: calc(100vh - var(--navbar-height));
}

/* Statistics Cards */
.stat-card {
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.3;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    border-radius: 0.25rem;
    font-weight: 500;
}

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

.btn-primary:hover {
    background-color: var(--zimbra-btn-primary-hover);
    border-color: var(--zimbra-btn-primary-hover);
}

.btn-primary:focus, .btn-primary.focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 149, 211, 0.35);
}

.btn-outline-primary {
    color: var(--zimbra-btn-primary);
    border-color: var(--zimbra-btn-primary);
}

.btn-outline-primary:hover {
    background-color: var(--zimbra-btn-primary);
    border-color: var(--zimbra-btn-primary);
}

.btn-group-sm > .btn {
    padding: 0.25rem 0.5rem;
}

/* Badges */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
}

/* Forms */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border-radius: 0.25rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--zimbra-accent);
    box-shadow: 0 0 0 0.2rem rgba(0, 149, 211, 0.25);
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, #0095D3 0%, #007BB8 100%);
    min-height: 100vh;
}

.login-page .card {
    border: none;
    border-radius: 1rem;
}

/* Breadcrumb */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.2rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9999;
}

/* DataTables Customization */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
}

/* Charts */
canvas {
    max-width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Utility Classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.shadow-sm-hover:hover {
    box-shadow: 0 0.125rem 0.5rem rgba(0,0,0,0.15) !important;
}

/* ======================================================
   Zimbra-Style Admin Sidebar (ZaTree)
   ====================================================== */

.za-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: 250px;
    background: var(--zimbra-sidebar-bg);
    color: var(--zimbra-sidebar-text);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--zimbra-sidebar-border);
    z-index: 1020;
}

.za-sidebar-header {
    padding: 16px;
    background: #EEEEEE;
    border-bottom: 1px solid var(--zimbra-sidebar-border);
}

.za-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--zimbra-sidebar-text);
}

.za-logo i {
    font-size: 20px;
    color: var(--zimbra-accent);
}

/* Navigation Tree */
.za-nav-tree {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.za-nav-section {
    margin-bottom: 4px;
}

/* Section Headers (Expandable) */
.za-nav-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--zimbra-sidebar-text);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    border-bottom: 1px solid transparent;
}

.za-nav-header:hover {
    background: var(--zimbra-sidebar-hover);
}

.za-nav-header .section-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.za-nav-header i:not(.section-arrow) {
    font-size: 14px;
    color: #666;
}

/* Child Items Container */
.za-nav-children {
    padding-left: 0;
}

/* Navigation Items */
.za-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 28px;
    color: var(--zimbra-sidebar-text);
    text-decoration: none;
    font-size: 12px;
    transition: all 0.15s ease;
    border-left: 2px solid transparent;
}

.za-nav-item:hover {
    background: var(--zimbra-sidebar-hover);
    text-decoration: none;
}

.za-nav-item.active {
    background: var(--zimbra-selection);
    color: var(--zimbra-sidebar-text);
    border-left-color: var(--zimbra-accent);
}

.za-nav-item i {
    font-size: 14px;
    width: 18px;
    text-align: center;
    color: #666;
}

.za-nav-item.active i {
    color: var(--zimbra-accent);
}

/* Top-level nav items (Home) */
.za-nav-section > .za-nav-item {
    padding-left: 16px;
}

/* Sidebar Footer */
.za-sidebar-footer {
    padding: 16px;
    background: #EEEEEE;
    border-top: 1px solid var(--zimbra-sidebar-border);
}

.za-version-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: center;
}

.za-version-info small {
    color: #7f8c8d;
    font-size: 11px;
}

/* Scrollbar for sidebar */
.za-nav-tree::-webkit-scrollbar {
    width: 6px;
}

.za-nav-tree::-webkit-scrollbar-track {
    background: transparent;
}

.za-nav-tree::-webkit-scrollbar-thumb {
    background: #CCCCCC;
    border-radius: 3px;
}

.za-nav-tree::-webkit-scrollbar-thumb:hover {
    background: #AAAAAA;
}

/* ======================================================
   Zimbra-Style Admin Content Area
   ====================================================== */

/* Adjust main content for new sidebar */
.main-content {
    margin-left: 260px;
    margin-top: var(--navbar-height);
    padding: 24px;
    min-height: calc(100vh - var(--navbar-height));
}

/* Zimbra-style page header */
.za-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--zimbra-border);
}

.za-page-header h2 {
    font-size: 18px;
    font-weight: bold;
    color: var(--zimbra-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.za-page-header h2 i {
    color: var(--zimbra-accent);
}

/* Zimbra-style Toolbar */
.za-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--zimbra-toolbar-bg);
    border: 1px solid var(--zimbra-border);
    border-radius: 6px;
    margin-bottom: 16px;
}

.za-toolbar .btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.za-toolbar-separator {
    width: 1px;
    height: 24px;
    background: #dee2e6;
    margin: 0 8px;
}

/* Zimbra-style List View */
.za-list-view {
    background: #fff;
    border: 1px solid var(--zimbra-border);
    border-radius: 6px;
    overflow: hidden;
}

.za-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--zimbra-toolbar-bg);
    border-bottom: 1px solid var(--zimbra-border);
}

.za-list-title {
    font-weight: 600;
    color: var(--zimbra-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.za-list-count {
    background: var(--zimbra-accent);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

/* Zimbra-style Form Tabs */
.za-form-tabs {
    display: flex;
    background: var(--zimbra-toolbar-bg);
    border-bottom: 1px solid var(--zimbra-border);
    padding: 0;
    margin-bottom: 24px;
}

.za-form-tab {
    padding: 12px 24px;
    color: #6c757d;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    transition: all 0.2s ease;
}

.za-form-tab:hover {
    color: var(--zimbra-text);
    text-decoration: none;
}

.za-form-tab.active {
    color: var(--zimbra-accent);
    border-bottom-color: var(--zimbra-accent);
    background: #fff;
}

/* Zimbra-style Form Groups */
.za-form-section {
    margin-bottom: 32px;
}

.za-form-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--zimbra-text);
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--zimbra-border);
}

.za-form-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
}

.za-form-label {
    width: 200px;
    flex-shrink: 0;
    padding-top: 8px;
    font-weight: 500;
    color: #495057;
}

.za-form-field {
    flex: 1;
}

.za-form-help {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .za-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .za-sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .za-form-row {
        flex-direction: column;
    }

    .za-form-label {
        width: 100%;
        padding-top: 0;
        margin-bottom: 8px;
    }
}
