/* ============================================================
   GLOBAL RESET & DASAR
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    background: #f3f4f6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: #0f766e;
}

button {
    font-family: inherit;
}

/* ============================================================
   LAYOUT: APP (sidebar + main)
   ============================================================ */
.app {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #0f172a 0%, #134e4a 100%);
    color: #e5e7eb;
    padding: 22px 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    overflow-y: auto;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 16px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-text { line-height: 1.2; }

.sidebar-brand-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.sidebar-brand-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.sidebar-menu {
    padding: 0 12px;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.menu-item:hover {
    background: rgba(20, 184, 166, 0.12);
    color: #fff;
}

.menu-item.active {
    background: linear-gradient(90deg, #14b8a6, #0d9488);
    color: #fff;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

.menu-icon {
    width: 22px;
    text-align: center;
    font-size: 16px;
    display: inline-flex;
    justify-content: center;
}

.sidebar-footer {
    padding: 16px 22px 0;
    margin-top: 20px;
    font-size: 11px;
    color: #64748b;
    line-height: 1.5;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-footer a {
    color: #14b8a6;
    text-decoration: none;
}

.sidebar-footer a:hover {
    text-decoration: underline;
}

/* ============================================================
   MAIN AREA
   ============================================================ */
.main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    background: #ffffff;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #0f766e;
    padding: 4px 8px;
    border-radius: 6px;
}

.menu-toggle:hover {
    background: #f0fdfa;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

/* ============================================================
   PROFILE DROPDOWN
   ============================================================ */
.profile-dropdown {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s ease;
}

.profile-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-info {
    text-align: left;
    line-height: 1.2;
}

.profile-name {
    display: block;
    font-weight: 600;
    color: #111827;
    font-size: 13px;
}

.profile-role {
    display: block;
    font-size: 11px;
    color: #6b7280;
}

.caret {
    font-size: 10px;
    color: #9ca3af;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.12),
                0 4px 8px -2px rgba(0, 0, 0, 0.06);
    min-width: 220px;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.15s ease;
    z-index: 50;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 10px 12px 6px;
    font-size: 11px;
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #374151;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.12s ease;
}

.dropdown-item:hover {
    background: #f3f4f6;
}

.dropdown-item.danger {
    color: #dc2626;
}

.dropdown-item.danger:hover {
    background: #fef2f2;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 6px 4px;
}

/* ============================================================
   CONTENT
   ============================================================ */
.content {
    flex: 1;
    padding: 28px;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ============================================================
   FLASH MESSAGE
   ============================================================ */
.flash {
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid transparent;
}

.flash-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.flash-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

/* ============================================================
   FOOTER APP
   ============================================================ */
.app-footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: #9ca3af;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.app-footer a {
    color: #0f766e;
    font-weight: 600;
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* ============================================================
   OVERLAY (mobile)
   ============================================================ */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 35;
}

.overlay.show {
    display: block;
}

/* ============================================================
   LOGIN / BARE WRAPPER
   ============================================================ */
.bare-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, #0f766e 0%, #0e7490 50%, #0c4a6e 100%);
    position: relative;
    overflow: hidden;
}

.bare-wrapper::before,
.bare-wrapper::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.bare-wrapper::before {
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
}

.bare-wrapper::after {
    bottom: -40%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.04);
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
textarea,
select {
    font-family: inherit;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
    }

    .menu-toggle {
        display: inline-block;
    }

    .content {
        padding: 20px 16px;
    }

    .topbar {
        padding: 12px 16px;
    }

    .topbar-title {
        font-size: 16px;
    }

    .profile-info {
        display: none;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 16px 12px;
    }
}