* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
}

/* LOGIN */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 20px;
}
.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-header {
    text-align: center;
    margin-bottom: 30px;
}
.login-header i {
    font-size: 48px;
    color: #f9a826;
}
.login-header h2 {
    color: #1a1a2e;
    margin: 10px 0 5px;
}
.login-header p {
    color: #888;
    font-size: 14px;
}
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 5px;
    color: #333;
}
.form-group label i {
    margin-right: 6px;
    color: #f9a826;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border 0.3s;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #f9a826;
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 168, 38, 0.1);
}
.btn-login {
    width: 100%;
    padding: 12px;
    background: #f9a826;
    color: #1a1a2e;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-login:hover {
    background: #f5b84a;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(249, 168, 38, 0.3);
}
.error-msg {
    color: #dc3545;
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
}

/* HEADER */
.header {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    padding: 18px 25px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.header h1 {
    font-size: 22px;
    font-weight: 300;
}
.header h1 i {
    color: #f9a826;
}
.user-badge {
    background: rgba(255,255,255,0.15);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
}
.user-badge#roleBadge {
    background: rgba(249,168,38,0.2);
    color: #f9a826;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.header-actions button {
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-add {
    background: #f9a826;
    color: #1a1a2e;
}
.btn-add:hover {
    background: #f5b84a;
    transform: translateY(-2px);
}
.btn-export {
    background: #28a745;
    color: #fff;
}
.btn-export:hover {
    background: #34ce57;
    transform: translateY(-2px);
}
.btn-admin {
    background: #6f42c1;
    color: #fff;
}
.btn-admin:hover {
    background: #8554d6;
    transform: translateY(-2px);
}
.btn-logout {
    background: #dc3545;
    color: #fff;
}
.btn-logout:hover {
    background: #e74c5e;
    transform: translateY(-2px);
}

/* NOTIFICATION BAR */
.notification-bar {
    background: #fff;
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    border-left: 5px solid #dc3545;
}
.notification-bar .bell {
    font-size: 20px;
    color: #dc3545;
}
.badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.badge {
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: #f8f9fa;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 5px;
}
.badge:hover {
    transform: scale(1.05);
}
.badge.danger {
    background: #dc3545;
    color: #fff;
}
.badge.warning {
    background: #ffc107;
    color: #1a1a2e;
}
.badge.success {
    background: #28a745;
    color: #fff;
}
.badge .count {
    background: rgba(0,0,0,0.15);
    padding: 0 8px;
    border-radius: 20px;
    font-size: 11px;
}

/* TOOLBAR */
.toolbar {
    background: #fff;
    border-radius: 12px;
    padding: 12px 18px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.search-box {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    background: #f0f2f5;
    border-radius: 8px;
    padding: 0 14px;
}
.search-box i {
    color: #888;
}
.search-box input {
    border: none;
    background: transparent;
    padding: 9px 12px;
    font-size: 14px;
    width: 100%;
    outline: none;
}
.filter-group select {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}
#totalCount {
    color: #888;
    font-size: 13px;
}

/* TABLE */
.table-wrapper {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.table-scroll {
    overflow-x: auto;
    padding: 0 4px 4px 4px;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 2000px;
}
thead {
    background: #1a1a2e;
    color: #fff;
}
thead th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 5;
    font-size: 11px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
tbody tr {
    border-bottom: 1px solid #eee;
    transition: background 0.15s;
}
tbody tr:hover {
    background: #f8f9fc;
}
tbody td {
    padding: 10px 8px;
    vertical-align: middle;
    white-space: nowrap;
}
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}
.status-dot.expired { background: #dc3545; }
.status-dot.warning { background: #ffc107; }
.status-dot.valid { background: #28a745; }

.expiry-label {
    font-size: 10px;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 600;
}
.expiry-label.expired {
    background: #dc3545;
    color: #fff;
}
.expiry-label.warning {
    background: #ffc107;
    color: #1a1a2e;
}
.expiry-label.valid {
    background: #d4edda;
    color: #155724;
}

.action-btns {
    display: flex;
    gap: 4px;
}
.action-btns button {
    border: none;
    background: transparent;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.action-btns .edit-btn { color: #007bff; }
.action-btns .edit-btn:hover { background: #e7f3ff; }
.action-btns .delete-btn { color: #dc3545; }
.action-btns .delete-btn:hover { background: #fde8ea; }

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-overlay.active {
    display: flex;
}
.modal-box {
    background: #fff;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-box h2 {
    margin-bottom: 20px;
    color: #1a1a2e;
    font-weight: 300;
}
.modal-box h2 i {
    color: #f9a826;
    margin-right: 10px;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.form-grid .form-group {
    margin-bottom: 0;
}
.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: flex-end;
}
.btn-save {
    background: #28a745;
    color: #fff;
    padding: 10px 30px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-save:hover {
    background: #34ce57;
    transform: translateY(-2px);
}
.btn-cancel {
    background: #dc3545;
    color: #fff;
    padding: 10px 30px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-cancel:hover {
    background: #e74c5e;
    transform: translateY(-2px);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .header {
        flex-direction: column;
        align-items: stretch;
    }
    .header-left {
        flex-wrap: wrap;
    }
    .modal-box {
        padding: 20px;
        margin: 10px;
    }
}
/* Field validation error styles */
.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 3px;
    display: block;
}

/* Required field indicator */
.form-group label[for*="f_"]:after {
    content: '';
    margin-left: 0;
}

/* Export button fix */
.btn-export {
    background: #28a745;
    color: #fff;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-export:hover {
    background: #34ce57;
    transform: translateY(-2px);
}
/* ===== MOBILE RESPONSIVE ===== */
@media screen and (max-width: 768px) {
    /* Header */
    .header {
        flex-direction: column;
        padding: 12px 15px;
    }
    .header-left {
        width: 100%;
        justify-content: center;
    }
    .header h1 {
        font-size: 18px;
    }
    .header-actions {
        width: 100%;
        justify-content: center;
        gap: 8px;
    }
    .header-actions button {
        font-size: 12px;
        padding: 6px 12px;
    }
    .user-badge {
        font-size: 11px;
        padding: 3px 10px;
    }

    /* Notification Bar */
    .notification-bar {
        padding: 10px 15px;
        flex-direction: column;
        align-items: stretch;
    }
    .badge-group {
        justify-content: center;
    }
    .badge {
        font-size: 11px;
        padding: 4px 10px;
    }

    /* Toolbar */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 15px;
    }
    .search-box {
        min-width: unset;
    }
    .filter-group {
        display: flex;
        gap: 8px;
    }
    .filter-group select {
        flex: 1;
        font-size: 12px;
        padding: 6px 10px;
    }
    #totalCount {
        text-align: center;
    }

    /* Table - Make it horizontally scrollable */
    .table-wrapper {
        border-radius: 8px;
    }
    .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table {
        font-size: 11px;
        min-width: 1000px;
    }
    thead th {
        font-size: 10px;
        padding: 8px 5px;
    }
    tbody td {
        padding: 6px 5px;
        font-size: 10px;
    }
    .action-btns button {
        font-size: 12px;
        padding: 3px 5px;
    }

    /* Modals */
    .modal-box {
        padding: 20px 15px;
        margin: 10px;
        max-width: 100%;
    }
    .modal-box h2 {
        font-size: 18px;
    }
    .form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .modal-actions {
        flex-direction: column;
    }
    .modal-actions button {
        width: 100%;
        justify-content: center;
    }

    /* Login */
    .login-box {
        padding: 25px 20px;
        margin: 10px;
    }
    .login-header h2 {
        font-size: 20px;
    }
}

/* ===== SMALL PHONES ===== */
@media screen and (max-width: 480px) {
    .header h1 {
        font-size: 15px;
    }
    .header-actions button {
        font-size: 10px;
        padding: 5px 8px;
    }
    .header-actions button i {
        font-size: 12px;
    }
    .badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    table {
        font-size: 9px;
        min-width: 800px;
    }
    thead th {
        font-size: 8px;
        padding: 5px 3px;
    }
    tbody td {
        padding: 4px 3px;
        font-size: 9px;
    }
    .modal-box {
        padding: 15px 10px;
    }
    .form-group label {
        font-size: 12px;
    }
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 12px;
        padding: 8px 10px;
    }
}