/* ========================================
   ADMIN PANEL - COMMON STYLES v2.4
   ======================================== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    display: flex;
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.5;
}

/* Left Sidebar Navigation */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 5px;
}

.sidebar-header .page-title {
    font-size: 14px;
    opacity: 0.8;
    font-weight: 400;
}

.nav-menu {
    flex: 1;
    padding: 20px 0;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    padding: 14px 20px;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.15);
    border-left-color: white;
}

.nav-menu a.active {
    background: rgba(255,255,255,0.2);
    border-left-color: white;
}

.nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

/* Sidebar Footer - Log Keluar at bottom */
.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 0;
}

.sidebar-footer .logout {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    padding: 14px 20px;
    transition: all 0.3s;
    border-left: 4px solid transparent;
    font-size: 16px;
}

.sidebar-footer .logout:hover {
    background: rgba(255,255,255,0.15);
    border-left-color: white;
}

.sidebar-footer .logout span {
    font-size: 16px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Bar (Optional - untuk breadcrumb atau user info) */
.topbar {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h2 {
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

/* Container */
.container {
    flex: 1;
    padding: 30px;
    max-width: 100%;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h2 {
    color: #333;
    font-size: 28px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
}

/* Section Card */
.section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

tr:hover {
    background: #f8f9fa;
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-in {
    background: #d4edda;
    color: #155724;
}

.badge-out {
    background: #f8d7da;
    color: #721c24;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Search Box */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px;
    color: #999;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 10px;
}

/* Alert Messages */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.d-flex { display: flex; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.gap-20 { gap: 20px; }

/* Mobile Menu Toggle Button - MODERN & BEAUTIFUL */
.menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1100;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    width: 55px;
    height: 55px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.menu-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.6);
}

.menu-toggle:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* Hamburger Icon - Smooth Animation */
.menu-toggle .hamburger {
    position: relative;
    width: 26px;
    height: 3px;
    background: white;
    margin: 0 auto;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle .hamburger::before,
.menu-toggle .hamburger::after {
    content: '';
    position: absolute;
    width: 26px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle .hamburger::before {
    top: -9px;
}

.menu-toggle .hamburger::after {
    top: 9px;
}

/* Animated X when menu open */
.menu-toggle.active {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 8px 24px rgba(118, 75, 162, 0.6);
}

.menu-toggle.active .hamburger {
    background: transparent;
}

.menu-toggle.active .hamburger::before {
    top: 0;
    transform: rotate(45deg);
    width: 28px;
}

.menu-toggle.active .hamburger::after {
    top: 0;
    transform: rotate(-45deg);
    width: 28px;
}

/* Overlay dengan blur effect */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
    }
    
    .container {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    /* Show beautiful menu toggle button */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Hide sidebar by default on mobile - Smooth slide */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
        z-index: 1001;
    }
    
    /* Show sidebar when active - Smooth slide in */
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0,0,0,0.4);
    }
    
    /* Main content full width on mobile */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* Topbar padding for menu button */
    .topbar {
        padding: 12px 15px !important;
        margin-left: 0 !important;
    }
    
    .topbar h2 {
        font-size: 18px;
        margin-left: 70px; /* Space for burger button */
    }
    
    .container { 
        padding: 15px; 
        margin-left: 0 !important;
    }
    
    .page-header { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .page-header h2 {
        font-size: 22px;
    }
    
    /* Stats grid - 2 columns on tablet */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
    
    /* Table responsive - scroll horizontal */
    .section {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 20px;
    }
    
    .section h3 {
        font-size: 18px;
    }
    
    table {
        min-width: 600px;
        font-size: 14px;
    }
    
    th, td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    /* Button sizing */
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .btn-small {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    /* Form adjustments */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 12px;
    }
    
    /* Modal adjustments */
    .modal-content {
        width: 95%;
        padding: 25px;
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    .topbar {
        padding: 10px 12px !important;
    }
    
    .topbar h2 {
        font-size: 16px;
        margin-left: 55px;
    }
    
    .container {
        padding: 10px;
    }
    
    .page-header h2 {
        font-size: 20px;
    }
    
    /* Stats grid - 2 columns untuk small mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    
    .stat-card .value {
        font-size: 20px !important;
    }
    
    .section {
        padding: 15px;
    }
    
    .section h3 {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px 5px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .btn-small {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    .badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .modal-content h2 {
        font-size: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* Tablet Landscape */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        margin-left: 220px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* Prevent text selection on touch devices */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-menu a, .sidebar-header {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}
