/* ==========================================================================
   AGRO-ERP Enterprise - Master Theme & Layout Engine
   File: public/assets/css/erp-theme.css
   ========================================================================== */

/* // MULAI: 1. VARIABEL & DESIGN TOKENS (LIGHT & DARK MODE) ================ */
:root {
    /* Brand Accent Colors (Dapat diubah via database setup) */
    --app-accent: #15803d;
    --app-accent-hover: #166534;
    --app-accent-rgb: 21, 128, 61;
    --app-accent-light: rgba(21, 128, 61, 0.08);

    /* Light Mode Tokens */
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    --bg-hover: #f8fafc;

    --border-color: #e2e8f0;
    --border-color-darker: #cbd5e1;
    --border-focus: rgba(21, 128, 61, 0.35);

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;

    --app-sidebar-bg: #ffffff;
    --app-navbar-bg: #ffffff;
    --app-sidebar-text: #475569;

    /* Shadow Elevation Tokens */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);

    /* Dimensions & Transitions */
    --sidebar-width: 250px;
    --sidebar-mini-width: 70px;
    --topbar-height: 60px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-bs-theme="dark"] {
    --bg-page: #0b0f19;
    --bg-card: #111827;
    --bg-subtle: #1e293b;
    --bg-hover: #1f293d;

    --border-color: #1f2937;
    --border-color-darker: #374151;
    --border-focus: rgba(34, 197, 94, 0.4);

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;

    --app-sidebar-bg: #0f172a;
    --app-navbar-bg: #0f172a;
    --app-sidebar-text: #94a3b8;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-size: 0.825rem;
    line-height: 1.45;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
/* // AKHIR: 1. VARIABEL & DESIGN TOKENS ==================================== */


/* // MULAI: 2. SIDEBAR NAVIGATION ========================================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--app-sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width var(--transition), transform var(--transition);
}

.brand-box {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 34px;
    height: 34px;
    min-width: 34px;
    background: linear-gradient(145deg, var(--app-accent), var(--app-accent-hover));
    color: #ffffff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 2px 6px rgba(var(--app-accent-rgb), 0.3);
}

.brand-title {
    font-weight: 800;
    font-size: 0.92rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.sidebar-menu-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 8px;
    list-style: none !important;
    margin: 0 !important;
}

.menu-category-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
    padding: 12px 12px 4px;
    list-style: none !important;
}

.nav-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    color: var(--app-sidebar-text);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.815rem;
    font-weight: 500;
    margin-bottom: 2px;
    background: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: var(--transition);
}

.nav-link-item:hover,
.nav-link-item.active {
    background: var(--app-accent-light);
    color: var(--app-accent);
}

.nav-link-item.active {
    font-weight: 600;
}

.nav-link-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    white-space: nowrap;
}

.nav-icon {
    font-size: 1rem;
    min-width: 18px;
    text-align: center;
}

.nav-chevron {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

.nav-link-item[aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
}

.submenu-list {
    list-style: none !important;
    padding: 2px 0 2px 20px !important;
    margin: 0 !important;
}

.submenu-list li {
    list-style: none !important;
}

.submenu-item-link {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    font-size: 0.785rem;
    color: var(--app-sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.submenu-item-link:hover,
.submenu-item-link.active {
    color: var(--app-accent);
    background: var(--app-accent-light);
}

.submenu-item-link.active {
    font-weight: 600;
}

/* Sidebar Collapsed Desktop */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-mini-width);
}

body.sidebar-collapsed .sidebar-text,
body.sidebar-collapsed .brand-details,
body.sidebar-collapsed .nav-chevron,
body.sidebar-collapsed .menu-category-title,
body.sidebar-collapsed .submenu-list {
    display: none !important;
}

body.sidebar-collapsed .brand-box {
    justify-content: center;
    padding: 0;
}

body.sidebar-collapsed .nav-link-item {
    justify-content: center;
    padding: 10px;
}

body.sidebar-collapsed .nav-link-left {
    gap: 0;
}
/* // AKHIR: 2. SIDEBAR NAVIGATION ======================================== */


/* // MULAI: 3. TOPBAR & MAIN WRAPPER ======================================= */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition), width var(--transition);
    width: calc(100% - var(--sidebar-width));
}

body.sidebar-collapsed .main-wrapper {
    margin-left: var(--sidebar-mini-width);
    width: calc(100% - var(--sidebar-mini-width));
}

.topbar-header {
    height: var(--topbar-height);
    background-color: var(--app-navbar-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: var(--shadow-xs);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-tool-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    text-decoration: none;
}

.topbar-tool-btn:hover {
    color: var(--app-accent);
    border-color: var(--app-accent);
    background: var(--app-accent-light);
}

.estate-pill {
    background: var(--app-accent-light);
    color: var(--app-accent);
    border: 1px solid rgba(var(--app-accent-rgb), 0.2);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.725rem;
    font-weight: 600;
}

.navbar-search-wrapper {
    position: relative;
    width: 220px;
    display: flex;
    align-items: center;
}

.navbar-search-wrapper input {
    background-color: var(--bg-subtle) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 20px !important;
    padding: 5px 12px 5px 32px !important;
    font-size: 0.785rem !important;
    width: 100%;
    outline: none;
    transition: var(--transition);
}

.navbar-search-wrapper input:focus {
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 3px var(--app-accent-light) !important;
}

.navbar-search-wrapper .search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.785rem;
    color: var(--text-muted);
    pointer-events: none;
}

.db-status-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 16px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.status-indicator-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
}

.notif-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    background-color: #ef4444;
    border-radius: 50%;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
}

.user-avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--app-accent), var(--app-accent-hover));
    color: #ffffff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: var(--shadow-xs);
}

.user-info-text {
    line-height: 1.15;
    text-align: left;
}

.user-name {
    font-size: 0.785rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.65rem;
    color: var(--text-muted);
}
/* // AKHIR: 3. TOPBAR & MAIN WRAPPER ======================================= */


/* // MULAI: 4. STANDAR TOMBOL (BUTTONS) ==================================== */
.btn-erp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.815rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-erp-primary {
    background-color: var(--app-accent);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(var(--app-accent-rgb), 0.2);
}

.btn-erp-primary:hover {
    background-color: var(--app-accent-hover);
    color: #ffffff;
    box-shadow: 0 4px 8px rgba(var(--app-accent-rgb), 0.3);
    transform: translateY(-1px);
}

.btn-erp-secondary {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-erp-secondary:hover {
    background-color: var(--bg-subtle);
    border-color: var(--border-color-darker);
    color: var(--text-primary);
}

.btn-erp-danger {
    background-color: #ef4444;
    color: #ffffff;
}

.btn-erp-danger:hover {
    background-color: #dc2626;
    color: #ffffff;
}

.btn-erp-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
}
/* // AKHIR: 4. STANDAR TOMBOL (BUTTONS) ==================================== */


/* // MULAI: 5. KONTEN & MODAL DIALOG ======================================= */
.page-content {
    padding: 24px;
    flex: 1;
}

.modal-content.card-table-box {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.modal-header {
    background-color: var(--bg-subtle);
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    background-color: var(--bg-subtle);
    border-top: 1px solid var(--border-color);
}
/* // AKHIR: 5. KONTEN & MODAL DIALOG ======================================= */