/* admin.css - Unified Admin Styles */
:root {
    --primary: #0b5e2a;
    --primary-light: #29a220;
    --secondary: #2e7d32;
    --danger: #d32f2f;
    --warning: #f57c00;
    --info: #0288d1;
    --light: #f5f7fa;
    --dark: #2c3e50;
    --accent: #7e57c2;
    --accent-light: #8e67d2;
    --gray: #6c757d;
    --border: #e1e5e9;
    --bg: #f8f9fa;
    --success: #28a745;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Admin Container */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* Session Warning Modal Styles */
#session-warning-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    padding: 0;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--warning);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-header {
    background: var(--warning);
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.modal-header i {
    font-size: 1.5rem;
}

.modal-body {
    padding: 25px 20px;
}

.modal-body p {
    margin-bottom: 15px;
    line-height: 1.5;
    color: var(--dark);
}

#countdown-timer {
    font-weight: bold;
    color: var(--danger);
    font-size: 1.1em;
}

.countdown-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
}

.countdown-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--warning) 0%, var(--danger) 100%);
    width: 100%;
    animation: countdownShrink 60s linear forwards;
}

@keyframes countdownShrink {
    from { width: 100%; }
    to { width: 0%; }
}

.modal-footer {
    padding: 15px 20px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
}

.modal-footer .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--gray);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Session Timer Display */
.session-timer {
    background: var(--dark);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
}

.session-timer.warning {
    background: var(--warning);
}

.session-timer.danger {
    background: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Security Notice */
.security-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Notification Styles */
.notification {
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.notification.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Sidebar Styles */
.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.1);
    text-align: center;
}

.sidebar-header h2 {
    margin-bottom: 5px;
    font-size: 1.3rem;
    font-weight: 600;
}

.sidebar-header p {
    opacity: 0.9;
    font-size: 0.85rem;
    color: #e3f2fd;
}

.admin-badge {
    background: var(--accent);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    margin-left: 5px;
    vertical-align: middle;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 15px 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0 10px 5px;
    border-radius: 8px;
    overflow: hidden;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.15);
    color: white;
    transform: translateX(5px);
}

.sidebar-menu a.active {
    background: rgba(255,255,255,0.2);
    color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.sidebar-menu i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.admin-alert-badge {
    background: var(--danger);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
    margin-left: auto;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

/* Main Content Styles */
.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 20px;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 15px;
}

.admin-header h1 {
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
}

.admin-header h1 i {
    color: var(--accent);
    font-size: 1.4rem;
}

.header-info {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-size: 0.85rem;
    color: var(--gray);
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-limit-info {
    background: #fff3e0;
    color: #e65100;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #ffb74d;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: center;
    border-top: 4px solid var(--primary);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.stat-card:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.stat-card.warning {
    border-top-color: var(--warning);
}

.stat-card.danger {
    border-top-color: var(--danger);
}

.stat-card.accent {
    border-top-color: var(--accent);
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
}

.stat-label {
    color: var(--gray);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.dashboard-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-left: 4px solid var(--primary);
    transition: all 0.3s;
}

.dashboard-card:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
}

.dashboard-card:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.card-header {
    margin-bottom: 15px;
    color: var(--dark);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 600;
}

.card-header i {
    color: var(--accent);
}

/* Table Styles */
.data-table, .admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.85rem;
}

.data-table th,
.data-table td,
.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th,
.admin-table th {
    background-color: var(--light);
    font-weight: 600;
    color: var(--dark);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover,
.admin-table tr:hover {
    background-color: rgba(0,0,0,0.02);
}

/* Checkbox column */
.checkbox-cell {
    width: 40px;
    text-align: center;
}

.bulk-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-block;
    text-transform: uppercase;
}

.status-active {
    background: #e8f5e8;
    color: var(--secondary);
}

.status-pending {
    background: #fff3e0;
    color: var(--warning);
}

.status-suspended {
    background: #ffebee;
    color: var(--danger);
}

.status-unknown {
    background: #f5f5f5;
    color: var(--gray);
}

/* Role Badges */
.role-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-block;
}

.role-admin {
    background: #ffebee;
    color: var(--danger);
}

.role-user {
    background: #e8f5e8;
    color: var(--secondary);
}

.role-unknown {
    background: #f5f5f5;
    color: var(--gray);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.btn-approve {
    background: var(--secondary);
    color: white;
}

.btn-approve:hover {
    background: #1e6b23;
}

.btn-suspend {
    background: var(--warning);
    color: white;
}

.btn-suspend:hover {
    background: #e66a00;
}

.btn-activate {
    background: var(--info);
    color: white;
}

.btn-activate:hover {
    background: #0274b3;
}

.btn-delete {
    background: var(--danger);
    color: white;
}

.btn-delete:hover {
    background: #b71c1c;
}

.btn-edit {
    background: var(--accent);
    color: white;
}

.btn-edit:hover {
    background: var(--accent-light);
}

.btn-export {
    background: var(--info);
    color: white;
}

.btn-export:hover {
    background: #0274b3;
}

/* Toggle Switch Styles */
.role-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-toggle-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--dark);
    min-width: 40px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--secondary);
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--danger);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-switch.disabled {
    opacity: 0.5;
}

.toggle-switch.disabled .toggle-slider {
    cursor: not-allowed;
    background-color: var(--gray);
}

.toggle-switch.loading .toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Bulk Actions */
.bulk-actions {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    display: none;
}

.bulk-actions.active {
    display: block;
    animation: slideIn 0.3s ease;
}

.bulk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.bulk-selection {
    font-weight: 500;
    color: var(--dark);
}

.bulk-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Filters and Search */
.filters-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.filters-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
    text-decoration: none;
    color: var(--gray);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    min-width: 250px;
    font-size: 0.85rem;
    transition: border-color 0.3s;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary);
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--gray);
    margin: 0 15px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
}

/* User Info Styles */
.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 2px;
}

.user-username {
    font-size: 0.75rem;
    color: var(--gray);
}

.user-email {
    font-weight: 500;
    margin-bottom: 2px;
}

.user-phone {
    font-size: 0.75rem;
    color: var(--gray);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s;
    text-align: center;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.action-btn i {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--primary);
}

.action-btn span {
    font-size: 0.85rem;
    font-weight: 500;
}

.view-all {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.view-all a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.view-all a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* Mobile Menu Toggle */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    z-index: 1100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .admin-table {
        font-size: 0.8rem;
    }
    
    .admin-table th, 
    .admin-table td {
        padding: 10px 12px;
    }
}

@media (max-width: 992px) {
    .admin-sidebar {
        width: 240px;
        transform: translateX(-100%);
    }
    
    .admin-sidebar.active {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
        width: 100%;
    }
    
    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .filters-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-form {
        width: 100%;
    }
    
    .search-box {
        flex: 1;
        min-width: auto;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .session-timer {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-main {
        padding: 15px;
    }
    
    .filters-container {
        padding: 15px;
    }
    
    .admin-table {
        font-size: 0.75rem;
    }
    
    .admin-table th, 
    .admin-table td {
        padding: 8px 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .admin-main {
        padding: 10px;
    }
    
    .filters {
        width: 100%;
        justify-content: space-between;
    }
    
    .filter-btn {
        flex: 1;
        text-align: center;
    }
    
    .admin-table {
        font-size: 0.7rem;
    }
    
    .admin-table th, 
    .admin-table td {
        padding: 6px 8px;
    }
    
    .bulk-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .bulk-buttons .btn {
        width: 100%;
        justify-content: center;
    }
}