/* ============================================
   RESET & BASE
============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0a3255;
    --primary-hover: #1a4a75;
    --success: #1b5e20;
    --warning: #e65100;
    --danger: #b71c1c;
    --info: #1565c0;
    --secondary: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #546e7a;
    --border: #cfd8dc;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   LOGIN PAGE
============================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.login-header .logo {
    font-size: 48px;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.login-header p {
    opacity: 0.9;
    font-size: 14px;
}

.login-form {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 50, 85, 0.1);
}

.login-footer {
    background: var(--secondary);
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

/* ============================================
   ALERT
============================================ */
.alert {
    padding: 15px 20px;
    margin: 20px 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.alert-error {
    background: #ffebee;
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.alert-success {
    background: #e8f5e9;
    color: var(--success);
    border-left: 4px solid var(--success);
}

/* ============================================
   BUTTON
============================================ */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(10, 50, 85, 0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #2e7d32;
}

.btn-secondary {
    background: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #b0bec5;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--secondary);
}

/* ============================================
   ADMIN LAYOUT
============================================ */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header .logo {
    font-size: 40px;
    margin-bottom: 10px;
}

.sidebar-header h2 {
    font-size: 20px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: var(--primary-hover);
    color: white;
    border-left: 4px solid #64b5f6;
}

.nav-icon {
    font-size: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-header {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.header-time {
    color: var(--text-secondary);
    font-size: 14px;
}

.content-wrapper {
    flex: 1;
    padding: 30px;
}

/* ============================================
   PAGE HEADER
============================================ */
.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 5px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============================================
   STATS GRID
============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px var(--shadow);
}

.stat-icon {
    font-size: 36px;
}

.stat-info h3 {
    font-size: 28px;
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 13px;
}

.stat-primary .stat-icon { color: var(--primary); }
.stat-success .stat-icon { color: var(--success); }
.stat-warning .stat-icon { color: var(--warning); }
.stat-danger .stat-icon { color: var(--danger); }
.stat-info .stat-icon { color: var(--info); }

/* ============================================
   CARD
============================================ */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 18px;
    color: var(--primary);
}

.card-body {
    padding: 24px;
}

/* ============================================
   TABLE
============================================ */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--secondary);
}

.table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.table tbody tr:hover {
    background: var(--secondary);
}

.text-center {
    text-align: center;
}

/* ============================================
   BADGE
============================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #e8f5e9;
    color: var(--success);
}

.badge-warning {
    background: #fff3e0;
    color: var(--warning);
}

.badge-danger {
    background: #ffebee;
    color: var(--danger);
}

.badge-info {
    background: #e3f2fd;
    color: var(--info);
}

/* ============================================
   FILTERS
============================================ */
.filters-bar {
    background: white;
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

.filter-form {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group select {
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.search-group {
    display: flex;
    gap: 10px;
    flex: 1;
}

.search-group input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

/* ============================================
   EDIT PAGE
============================================ */
.edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.info-value {
    color: var(--text-primary);
}

.license-status {
    margin-bottom: 20px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.status-badge.status-success {
    background: #e8f5e9;
    border-left: 4px solid var(--success);
}

.status-badge.status-warning {
    background: #fff3e0;
    border-left: 4px solid var(--warning);
}

.status-badge.status-danger {
    background: #ffebee;
    border-left: 4px solid var(--danger);
}

.badge-icon {
    font-size: 32px;
}

.status-badge strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.status-badge p {
    font-size: 14px;
    color: var(--text-secondary);
}

.action-form .form-group {
    margin-bottom: 20px;
}

.action-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.action-form input[type="number"],
.action-form input[type="datetime-local"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* ============================================
   SWITCH
============================================ */
.switch-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.switch-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.switch-slider {
    width: 50px;
    height: 26px;
    background: var(--border);
    border-radius: 26px;
    position: relative;
    transition: background 0.3s;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.switch-label input:checked + .switch-slider {
    background: var(--success);
}

.switch-label input:checked + .switch-slider::before {
    transform: translateX(24px);
}

.switch-text {
    font-weight: 600;
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .edit-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .content-wrapper {
        padding: 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .filter-form {
        flex-direction: column;
        width: 100%;
    }

    .filter-group,
    .search-group {
        width: 100%;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .login-card {
        border-radius: 0;
    }

    .login-form {
        padding: 20px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-icon {
        font-size: 28px;
    }

    .stat-info h3 {
        font-size: 22px;
    }
}