/**
 * Admin Panel Modern Design System - FISIP UBK
 * Cross-browser normalized inputs, buttons, dashboard layouts, and Quill editor styling
 */

:root {
    --primary: #FF4800;
    --primary-hover: #E03E00;
    --primary-light: #fff5f0;
    --primary-ring: rgba(255, 72, 0, 0.18);
    --secondary: #1a1a2e;
    --secondary-light: #252542;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --warning-hover: #d97706;
    --info: #3b82f6;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --card-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --modal-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f8fafc;
    color: var(--slate-800);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================================
   Requirement 14: Cross-Browser Consistent Buttons
   ======================================================== */
button, input[type="button"], input[type="submit"], input[type="reset"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-family: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.35;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    vertical-align: middle;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(255, 72, 0, 0.2);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(255, 72, 0, 0.3);
}

.btn-secondary {
    background-color: var(--slate-600);
    color: #ffffff;
}
.btn-secondary:hover {
    background-color: var(--slate-700);
    color: #ffffff;
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}
.btn-success:hover {
    background-color: var(--success-hover);
    color: #ffffff;
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
    background-color: var(--danger-hover);
    color: #ffffff;
}

.btn-warning {
    background-color: var(--warning);
    color: #ffffff;
}
.btn-warning:hover {
    background-color: var(--warning-hover);
    color: #ffffff;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--slate-300);
    color: var(--slate-700);
}
.btn-outline:hover {
    background-color: var(--slate-100);
    border-color: var(--slate-400);
    color: var(--slate-900);
}

.btn-outline-primary {
    background-color: transparent;
    border-color: var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover {
    background-color: var(--primary-light);
    color: var(--primary-hover);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 13px 28px;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ========================================================
   Requirement 8: Professional, Elegant & Consistent Textboxes
   ======================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--slate-700);
}

.form-label.required::after {
    content: " *";
    color: var(--danger);
}

.form-control,
.form-select,
.form-textarea {
    width: 100%;
    font-family: inherit;
    font-size: 0.93rem;
    color: var(--slate-800);
    background-color: #ffffff;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-control {
    height: 44px;
}

.form-select {
    height: 44px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px 10px;
    padding-right: 38px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-textarea {
    min-height: 110px;
    resize: vertical;
}

.form-control:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--slate-300);
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px var(--primary-ring);
    background-color: #ffffff;
}

.form-control::placeholder,
.form-textarea::placeholder {
    color: var(--slate-400);
    opacity: 0.9;
}

.form-control[disabled],
.form-select[disabled],
.form-textarea[disabled],
.form-control[readonly] {
    background-color: var(--slate-100);
    border-color: var(--slate-200);
    color: var(--slate-500);
    cursor: not-allowed;
}

.form-text {
    font-size: 0.8rem;
    color: var(--slate-500);
    margin-top: 5px;
}

.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group .form-control {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .input-group-append .btn,
.input-group .input-group-append span {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-left: -1px;
}

/* ========================================================
   Requirement 9 & 20: Quill Editor Enhanced Styling
   ======================================================== */
.quill-wrapper {
    background: #ffffff;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.quill-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px var(--primary-ring);
}

.quill-wrapper .ql-toolbar {
    background: var(--slate-50);
    border: none;
    border-bottom: 1.5px solid var(--slate-200);
    padding: 10px 12px;
}

.quill-wrapper .ql-container {
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    min-height: 180px;
}

.quill-wrapper .ql-editor {
    min-height: 180px;
    padding: 16px;
    color: var(--slate-800);
    line-height: 1.6;
}

.quill-wrapper .ql-editor p {
    color: var(--slate-800);
    margin-bottom: 10px;
}

/* Native Rich Editor Fallback Toolbar */
.native-rich-toolbar {
    background: var(--slate-50);
    border-bottom: 1.5px solid var(--slate-200);
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.native-rich-toolbar button {
    background: #ffffff;
    border: 1px solid var(--slate-300);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.85rem;
    color: var(--slate-700);
    cursor: pointer;
    transition: all 0.15s;
}

.native-rich-toolbar button:hover {
    background: var(--slate-200);
    color: var(--primary);
}

/* ========================================================
   Requirement 5: Modern Dashboard & Layout
   ======================================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Top Navbar */
.admin-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Sidebar Toggle Hamburger (for mobile/tablet) */
.sidebar-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    color: var(--slate-700);
    cursor: pointer;
    font-size: 1.15rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.sidebar-toggle-btn:active {
    transform: scale(0.95);
}

/* Mobile Sidebar Header & Close Button */
.sidebar-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--slate-200);
    margin-bottom: 10px;
    background: #ffffff;
}

.sidebar-mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-mobile-brand img {
    height: 34px;
    width: auto;
}

.mobile-brand-title {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.mobile-brand-title strong {
    font-size: 1rem;
    color: var(--slate-900);
}

.mobile-brand-title small {
    font-size: 0.72rem;
    color: var(--slate-500);
}

.sidebar-close-btn {
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 1.1rem;
    color: var(--slate-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-close-btn:hover {
    background: #fee2e2;
    color: var(--danger);
    border-color: var(--danger);
}

/* Mobile Backdrop Overlay */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--slate-900);
}

.topbar-brand img {
    height: 42px;
    width: auto;
}

.brand-text h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--slate-900);
    line-height: 1.2;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--slate-500);
    font-weight: 400;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.lang-switch {
    display: flex;
    align-items: center;
    background: var(--slate-100);
    border-radius: var(--radius-full);
    padding: 4px;
    gap: 2px;
}

.lang-btn {
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-decoration: none;
    color: var(--slate-600);
    transition: all 0.2s;
}

.lang-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-full);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ff884d);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-details {
    line-height: 1.2;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--slate-900);
}

.user-role {
    font-size: 0.72rem;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar */
.admin-sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    bottom: 0;
    width: 260px;
    background: #ffffff;
    border-right: 1px solid var(--slate-200);
    padding: 20px 0;
    overflow-y: auto;
    z-index: 999;
}

.sidebar-category {
    padding: 12px 24px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--slate-400);
    letter-spacing: 0.8px;
}

.sidebar-menu {
    list-style: none;
    padding: 0 12px;
}

.sidebar-menu li {
    margin-bottom: 3px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--slate-600);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    color: var(--slate-400);
    transition: color 0.2s;
}

.sidebar-link:hover {
    background: var(--slate-100);
    color: var(--primary);
}

.sidebar-link:hover i {
    color: var(--primary);
}

.sidebar-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-link.active i {
    color: var(--primary);
}

/* Main Content Wrapper */
.admin-main {
    margin-left: 260px;
    margin-top: 70px;
    padding: 30px;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
}

.page-container {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.page-title {
    min-width: 0;
}

.page-title h1 {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--slate-900);
    word-break: break-word;
}

.page-title p {
    font-size: 0.9rem;
    color: var(--slate-500);
    margin-top: 4px;
    word-break: break-word;
}

/* Default Password Security Warning Banner (Requirement 7) */
.security-alert-banner {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1.5px solid #fde68a;
    border-left: 5px solid var(--warning);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.08);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.security-alert-content {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.security-alert-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.security-alert-text {
    min-width: 0;
    flex: 1;
    word-break: break-word;
    overflow-wrap: break-word;
}

.security-alert-text h4 {
    color: #92400e;
    font-size: 0.98rem;
    font-weight: 700;
    margin-bottom: 3px;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: break-word;
}

.security-alert-text p {
    color: #b45309;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: break-word;
}

.security-alert-action {
    flex-shrink: 0;
}

.security-alert-btn {
    white-space: nowrap;
}

/* Cards & Grid */
.card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-200);
    box-shadow: var(--card-shadow);
    padding: 24px;
    margin-bottom: 25px;
    transition: box-shadow 0.2s ease;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.card:hover {
    box-shadow: var(--card-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--slate-100);
}

.card-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--slate-900);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.stat-box {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-200);
    padding: 22px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
    border-top: 4px solid var(--primary);
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.stat-box:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-hover);
}

.stat-info {
    min-width: 0;
    flex: 1;
}

.stat-info .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--slate-900);
    line-height: 1.1;
    word-break: break-word;
}

.stat-info .stat-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--slate-500);
    margin-top: 6px;
    word-break: break-word;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* Dashboard Row Grid (Quick Actions & System Info) */
.dashboard-row-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 20px;
    margin-bottom: 25px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.quick-action-btn {
    justify-content: flex-start;
    padding: 10px 14px;
    font-size: 0.88rem;
    min-width: 0;
    word-break: break-word;
}

.quick-action-btn span {
    white-space: normal;
    word-break: break-word;
    text-align: left;
}

.system-info-list {
    font-size: 0.88rem;
    color: var(--slate-600);
    line-height: 1.8;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.system-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--slate-100);
    padding: 8px 0;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
    box-sizing: border-box;
}

.system-info-row:last-child {
    border-bottom: none;
}

.system-info-row span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--slate-600);
    min-width: 0;
}

.system-info-row strong {
    color: var(--slate-800);
    text-align: right;
    word-break: break-word;
}

/* Tables & Mobile Responsiveness */
.table-responsive {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    background: #ffffff;
    scrollbar-width: thin;
    scrollbar-color: var(--slate-300) var(--slate-100);
    margin-bottom: 0;
    box-sizing: border-box;
    display: block;
}

/* Custom Scrollbar for Smooth Horizontal Scrolling */
.table-responsive::-webkit-scrollbar {
    height: 7px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--slate-100);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 4px;
    border: 1.5px solid var(--slate-100);
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--slate-400);
}

/* Mobile Scroll Indicator / Badge */
.table-scroll-hint {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--slate-600);
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    margin-bottom: 12px;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
}

.table-scroll-hint i {
    color: var(--primary);
    animation: tableScrollPulse 1.8s infinite ease-in-out;
}

@keyframes tableScrollPulse {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

@media (max-width: 992px) {
    .table-scroll-hint {
        display: inline-flex;
    }
}

.table {
    width: 100%;
    min-width: 600px; /* Crucial: Prevents crushing columns into vertical stacks on mobile, activates smooth horizontal scroll */
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
    text-align: left;
}

.table.table-wide {
    min-width: 750px;
}

.table th {
    background: var(--slate-50);
    color: var(--slate-700);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1.5px solid var(--slate-200);
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-700);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: #f8fafc;
}

/* Action buttons, badges, and code tags inside tables */
.table .btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.table .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.table td .badge {
    white-space: nowrap;
}

.table td code {
    white-space: nowrap;
    background: var(--slate-100);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-secondary {
    background: var(--slate-100);
    color: var(--slate-600);
}

/* Flash Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-overlay.active {
    display: flex !important;
}

.modal-dialog {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--modal-shadow);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlide 0.25s ease;
}

.modal-dialog.modal-lg {
    max-width: 850px;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid var(--slate-100);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--slate-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--slate-400);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--slate-700);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 25px;
    border-top: 1px solid var(--slate-100);
    background: var(--slate-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Tabs */
.tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 1.5px solid var(--slate-200);
    margin-bottom: 25px;
}

.tab-nav-btn {
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--slate-500);
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab-nav-btn:hover {
    color: var(--primary);
}

.tab-nav-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1.5px;
    left: 0;
    right: 0;
    height: 2.5px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Admin Footer */
.admin-footer {
    margin-top: auto;
    padding-top: 25px;
    border-top: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--slate-500);
    font-size: 0.85rem;
}

/* ========================================================
   Comprehensive Mobile & Tablet Responsiveness
   Applied to all Admin Elements, Modules & Layouts
   ======================================================== */

/* Table Scrollbar Styling for Mobile Touch Scrollers */
.table-responsive::-webkit-scrollbar {
    height: 5px;
}
.table-responsive::-webkit-scrollbar-track {
    background: var(--slate-100);
    border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Tabs Horizontal Scroller Hide Ugly Scrollbars */
.tabs-nav::-webkit-scrollbar {
    height: 0px;
    display: none;
}
.tabs-nav {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- Breakpoint 1: Tablet Viewport (<= 992px) --- */
@media (max-width: 992px) {
    /* Topbar */
    .admin-topbar {
        height: 64px;
        padding: 0 18px;
    }

    .sidebar-toggle-btn {
        display: flex;
    }

    .topbar-brand img {
        height: 36px;
    }

    .brand-text h2 {
        font-size: 1.05rem;
    }

    .brand-text span {
        font-size: 0.7rem;
    }

    .topbar-right {
        gap: 10px;
    }

    /* Off-Canvas Mobile Drawer Sidebar */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 290px;
        max-width: 86vw;
        height: 100vh;
        background: #ffffff;
        box-shadow: 6px 0 25px rgba(0, 0, 0, 0.22);
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        padding-top: 0;
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-mobile-header {
        display: flex;
    }

    /* Main Content Area */
    .admin-main {
        margin-left: 0;
        margin-top: 64px;
        padding: 20px 16px;
        min-height: calc(100vh - 64px);
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
}

/* --- Breakpoint 2: Large Phone & Small Tablet (<= 768px) --- */
@media (max-width: 768px) {
    /* Responsive Topbar Button Text */
    .btn-text-responsive {
        display: none !important;
    }

    .topbar-btn {
        padding: 8px 12px;
        min-width: 38px;
        height: 38px;
        gap: 0;
    }

    .user-profile-badge {
        padding: 4px;
        border-radius: 50%;
        border-color: transparent;
        background: transparent;
    }

    .user-details {
        display: none !important;
    }

    /* Main Area Mobile */
    .admin-main {
        padding: 16px 12px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* Page Header */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        margin-bottom: 20px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .page-header > div:last-child {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .page-header > div:last-child .btn,
    .page-header > div:last-child a.btn,
    .page-header > div:last-child button.btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .page-title h1 {
        font-size: 1.35rem;
    }

    .page-title p {
        font-size: 0.85rem;
    }

    /* Cards */
    .card {
        padding: 16px 14px;
        margin-bottom: 16px;
        border-radius: var(--radius-md);
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .card-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding-bottom: 12px;
        width: 100%;
        box-sizing: border-box;
    }

    .card-header > div:last-child,
    .card-header > button,
    .card-header > a {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .card-header > div:last-child .btn,
    .card-header > button.btn,
    .card-header > a.btn {
        width: 100%;
        min-height: 42px;
        justify-content: center;
    }

    /* Stats Grid on <= 768px */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 18px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .stat-box {
        padding: 14px 12px;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .stat-info .stat-value {
        font-size: 1.5rem;
    }

    .stat-info .stat-name {
        font-size: 0.78rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1.15rem;
    }

    .dashboard-row-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        margin-bottom: 18px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .quick-actions-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)) !important;
        gap: 8px !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* Auto-collapse any multi-column grids in cards/modals on mobile */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* Tables Mobile Ergonomics */
    .table-responsive {
        border-radius: var(--radius-md);
        margin-bottom: 12px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .table {
        min-width: 560px;
    }

    .table th {
        padding: 10px 12px;
        font-size: 0.72rem;
        white-space: nowrap;
    }

    .table td {
        padding: 11px 12px;
        font-size: 0.84rem;
    }

    /* Table Action buttons on touch devices */
    .table .btn-sm {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    .table .btn-icon {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Tabs Nav horizontal scroll */
    .tabs-nav {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 4px;
        padding-bottom: 2px;
    }

    .tab-nav-btn {
        padding: 10px 14px;
        font-size: 0.88rem;
        flex-shrink: 0;
    }

    /* Modals Mobile Bottom Sheet Style */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-dialog {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
        animation: modalSlideUpMobile 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes modalSlideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .modal-header {
        padding: 14px 18px;
    }

    .modal-header h3 {
        font-size: 1.15rem;
    }

    .modal-body {
        padding: 16px 16px;
        max-height: calc(88vh - 120px);
        overflow-y: auto;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
    }

    /* Security Warning Banner */
    .security-alert-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px 14px;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .security-alert-content {
        align-items: flex-start;
        gap: 12px;
        width: 100%;
        min-width: 0;
    }

    .security-alert-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
        margin-top: 2px;
        flex-shrink: 0;
    }

    .security-alert-text {
        min-width: 0;
        flex: 1;
    }

    .security-alert-text h4 {
        font-size: 0.9rem;
    }

    .security-alert-text p {
        font-size: 0.82rem;
    }

    .security-alert-action,
    .security-alert-btn {
        width: 100%;
        min-height: 42px;
        justify-content: center;
        box-sizing: border-box;
    }

    /* Footer */
    .admin-footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding-top: 20px;
    }
}

/* --- Breakpoint 3: Mobile Phone (<= 576px) --- */
@media (max-width: 576px) {
    /* Topbar compact */
    .admin-topbar {
        height: 58px;
        padding: 0 10px;
    }

    .sidebar-toggle-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .topbar-left {
        gap: 8px;
    }

    .topbar-brand {
        gap: 6px;
    }

    .topbar-brand img {
        height: 28px;
    }

    .brand-text h2 {
        font-size: 0.88rem;
    }

    .brand-text span {
        display: none !important;
    }

    .topbar-right {
        gap: 6px;
    }

    /* Hide "Lihat Website" in topbar on phone (available in sidebar) */
    .topbar-right a[href*="index.php"] {
        display: none !important;
    }

    .lang-switch {
        padding: 2px;
    }

    .lang-btn {
        padding: 3px 6px;
        font-size: 0.7rem;
    }

    .user-profile-badge {
        padding: 0;
        background: transparent;
        border: none;
    }

    .user-details {
        display: none !important;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .topbar-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
        padding: 0;
        font-size: 0.82rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Main Area */
    .admin-main {
        margin-top: 58px;
        padding: 12px 10px;
        min-height: calc(100vh - 58px);
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .stat-box {
        padding: 10px 8px;
        border-radius: var(--radius-md);
        border-top-width: 3px;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .stat-info .stat-value {
        font-size: 1.25rem;
    }

    .stat-info .stat-name {
        font-size: 0.7rem;
        line-height: 1.25;
        margin-top: 2px;
    }

    .stat-icon {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
        border-radius: 6px;
    }

    /* Cards */
    .card {
        padding: 14px 10px;
        border-radius: var(--radius-md);
        margin-bottom: 12px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* Security Warning Banner on Small Mobile */
    .security-alert-banner {
        padding: 12px 10px;
        margin-bottom: 12px;
        border-radius: var(--radius-md);
        gap: 10px;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .security-alert-icon {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .security-alert-text h4 {
        font-size: 0.82rem;
        line-height: 1.35;
    }

    .security-alert-text p {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    .system-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        padding: 6px 0;
    }

    .system-info-row strong {
        text-align: left;
        padding-left: 28px;
        font-size: 0.82rem;
    }

    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    .quick-action-btn {
        padding: 8px 8px;
        font-size: 0.78rem;
    }

    /* Buttons */
    .btn {
        min-height: 42px;
        font-size: 0.88rem;
    }

    /* Table Mobile Optimizations (<= 576px) */
    .table-responsive {
        margin-bottom: 8px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .table {
        min-width: 500px;
        font-size: 0.8rem;
    }

    .table th {
        padding: 8px 10px;
        font-size: 0.68rem;
    }

    .table td {
        padding: 8px 10px;
    }

    .table-scroll-hint {
        width: 100%;
        font-size: 0.74rem;
        padding: 5px 9px;
        margin-bottom: 8px;
    }

    /* Forms on Mobile */
    .form-group {
        margin-bottom: 15px;
    }

    .form-label {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }

    .form-control,
    .form-select {
        height: 42px;
        font-size: 0.9rem;
        padding: 8px 12px;
    }

    /* Quill Editor on Mobile */
    .quill-wrapper .ql-toolbar {
        padding: 6px 8px;
        gap: 3px;
    }

    .quill-wrapper .ql-toolbar button {
        width: 28px;
        height: 28px;
        padding: 2px;
    }

    .quill-wrapper .ql-container {
        min-height: 130px;
        font-size: 0.9rem;
    }

    .quill-wrapper .ql-editor {
        min-height: 130px;
        padding: 12px;
    }

    /* Telegram Status & Checkbox Banners */
    .settings-status-banner {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 14px 16px !important;
    }

    /* Section Order Items */
    .section-item {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 12px 14px !important;
    }

    .section-item > div:last-child {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding-top: 10px;
        border-top: 1px dashed var(--slate-200);
    }

    /* Auth Cards (Login & Forgot Password) */
    .auth-card {
        border-radius: 14px;
        box-shadow: 0 15px 35px -8px rgba(0, 0, 0, 0.35);
    }

    .auth-header {
        padding: 22px 18px 16px;
    }

    .auth-logo {
        height: 54px;
    }

    .auth-header h1 {
        font-size: 1.25rem;
    }

    .auth-body {
        padding: 18px 16px 24px;
    }
}

/* --- Breakpoint 4: Ultra Narrow Phone (<= 380px) --- */
@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr !important;
    }

    .topbar-brand img {
        height: 28px;
    }

    .brand-text h2 {
        font-size: 0.88rem;
    }

    .lang-switch {
        display: none; /* Hide language toggle in topbar on ultra narrow to preserve space */
    }
}
