/* =========================================================
   ApexFarm – FINAL BASE.CSS
   Clean – Stable – Non‑Leaking – Dashboard Safe
   LTR – Desktop First – Mobile ≤1200px
========================================================= */

/* ===============================
   🔹 ROOT / BASE
=============================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: #0f172a;
    color: #e2e8f0;
    font-family: "Segoe UI", "Roboto", sans-serif;
    direction: ltr;
}

a {
    text-decoration: none;
}

.dashboard-bg {
    min-height: 100vh;
    background-color: #0f172a;
}

/* ===============================
   🔹 NAVBAR (TOP)
=============================== */

.navbar {
    height: 60px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    z-index: 900;
}

.navbar-brand {
    font-weight: 700;
    color: #10b981 !important;
}

/* Hamburger */
.hamburger-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    z-index: 900;
}

@media (min-width: 1201px) {
    .hamburger-btn {
        display: none;
    }
}

/* ===============================
   🔹 SIDEBAR (LEFT)
=============================== */

#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 240px;
    height: 100vh;
background: #0f172a;
    border-right: 1px solid #334155;
    transform: translateX(0);
    transition: transform 0.3s ease;
    z-index: 850;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Mobile / Tablet */
@media (max-width: 1200px) {
    #sidebar {
        transform: translateX(-100%) !important;
    }
    #sidebar.open {
        transform: translateX(0) !important;
    }
}

/* ===============================
   🔹 SIDEBAR CONTENT
=============================== */

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid #334155;
}

.brand-icon {
    font-size: 22px;
}

.brand-text {
    font-size: 18px;
    font-weight: 700;
    color: #10b981;
}

.sidebar-menu {
    flex: 1;
    padding: 8px 0;

}

.menu-item {
    margin-bottom: 4px;

}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 0 8px;
    border-radius: 8px;
    color: #cbd5e1;
    transition: 0.25s;
    border-left: 3px solid transparent;
}

.menu-link:hover,
.menu-item.active .menu-link {
    background: rgba(16,185,129,0.12);
    border-left-color: #10b981;
    color: #10b981;
}

.menu-icon {
    font-size: 18px;
    min-width: 26px;
    text-align: center;
}

.menu-text {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-footer {
    border-top: 1px solid #334155;
    padding: 10px 0;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 0 8px;
    border-radius: 8px;
    color: #ef4444;
    transition: 0.25s;
}

.logout-link:hover {
    background: rgba(239,68,68,0.15);
}

/* ===============================
   🔹 OVERLAY
=============================== */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    z-index: 800;
}

.sidebar-overlay.visible {
    display: block;
}

/* ===============================
   🔹 MAIN CONTENT
=============================== */

#main-content {
    margin-left: 240px;
    padding: 20px;
    min-height: 100vh;
    transition: 0.3s;
}

@media (max-width: 1200px) {
    #main-content {
        margin-left: 0 !important;
    }
}

#main-content.with-submenu {
    margin-top: 60px;
}

/* ===============================
   🔹 SUBMENU BAR (HORIZONTAL)
=============================== */

.submenu-bar {
    position: fixed;
    top: 0;
    left: 240px;
    right: 0;
    height: 60px;
    background: #0f172a;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    z-index: 850;
}

@media (max-width: 1200px) {
    .submenu-bar {
        left: 0;
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        position: relative;
    }
}

.submenu-content {
    display: none;
    flex-wrap: wrap;
    gap: 12px;
}

.submenu-content.active {
    display: flex;
}

.submenu-link {
    background: rgba(30,41,59,0.8);
    border: 1px solid #334155;
    padding: 8px 14px;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
    transition: 0.25s;
}

.submenu-link:hover,
.submenu-link.active-submenu {
    background: #10b981;
    color: #0f172a;
    border-color: #10b981;
}

.submenu-user {
    margin-left: auto;
    display: flex;
    align-items: center;
}

/* ===============================
   🔹 TABLES
=============================== */

.table-dark {
    background-color: #0f172a;
    color: #f8fafc;
    border-color: #334155;
}

.table-dark thead {
    background-color: #020617;
    border-bottom: 2px solid #10b981;
}
.table-responsive {
    border: none !important;
}

.card .table-responsive {
    background-color: #1e293b;
}


th, td {
    vertical-align: middle;
    font-size: 14px;
}

/* Status Dot */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online { background: #10b981; }
.status-dot.offline { background: #ef4444; }
.status-dot.warning { background: #f59e0b; }

/* ===============================
   🔹 BUTTONS
=============================== */

.btn-primary { background:#10b981; border-color:#10b981; color:#0f172a; }
.btn-primary:hover { background:#059669; }

.btn-danger { background:#ef4444; border-color:#ef4444; }
.btn-danger:hover { background:#dc2626; }

.btn-warning { background:#f59e0b; border-color:#f59e0b; color:#0f172a; }
.btn-warning:hover { background:#d97706; }

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

/* ===============================
   🔹 FORMS
=============================== */

.form-control,
.form-select {
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
}

.form-control:focus,
.form-select:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 .2rem rgba(16,185,129,.25);
}

/* ===============================
   🔹 MODALS
=============================== */

.modal-dark {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
}

.modal-dark .modal-header,
.modal-dark .modal-footer {
    background: #0f172a;
}

/* ===============================
   🔹 ALERTS
=============================== */

.alert-info-dark {
    background: #1e3a5f;
    border: 1px solid #3b82f6;
    color: #e2e8f0;
}

.alert-danger {
    background: #7f1d1d;
    border: 1px solid #991b1b;
}

/* ===============================
   🚫 GLOBAL CHART SHIELD
   (NO CHART LEAKING ALLOWED)
=============================== */



/* ===============================
   ✅ END OF FILE
=============================== */
.dashboard-container {
    width: 100%;
    max-width: 100%;
    margin: 0;

    background-color: #1e293b;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
}
/* ✅ Mobile – Vertical Submenu (ONLY ACTIVE ONE) */
@media (max-width: 768px) {

    .submenu-bar {
        position: relative !important;
        left: 0 !important;
        width: 100% !important;
        right: 0;
        top: 0;

        height: auto;
        padding: 12px 18px;
        margin-bottom: 16px;

        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;

        background: #0f172a;
        border-bottom: 1px solid #334155;
        white-space: normal;
    }

    /* 🔑 فقط submenu فعال */
    .submenu-content {
        display: none;
    }

    .submenu-content.active {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .submenu-link {
        width: 100%;
        padding: 12px 14px;
        text-align: left;
        white-space: normal;
    }

    .submenu-user {
        margin-left: 0;
        border-top: 1px solid #334155;
        padding-top: 8px;
    }
}

/* ===============================
   🔐 LOGIN CARD (ApexFarm Theme)
=============================== */
.login-card {
    background: #1e293b;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
/* ===============================
   🔐 load combo box for realtime table (ApexFarm Theme)
=============================== */
.column-selector select[multiple] {
  height: auto;
  min-height: 120px;
  background-color: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 4px 6px;
}

.column-selector select option {
  padding: 3px 6px;
}
.column-selector label {
  font-weight: 500;
}
.tree-dropdown-container {
    position: relative;
    display: inline-block;
    width: auto; /* نه فول اسکرین */
}

.tree-dropdown-btn {
    background-color: #1e293b;
    color: #f8fafc;
    border: 1px solid #334155;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    min-width: 180px;
    text-align: right;
}

.tree-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 1000;
    max-height: 350px;
    overflow-y: auto;
    padding: 15px;
}
.tree-menu.show {
    display: block;
}

.tree-item {
    margin-bottom: 8px;
    font-size: 15px;
    color: #e2e8f0;
}
