/* ParentPal - Admin Panel Modern Styles
 * Version 6.0 - Clean, professional dashboard design
 */

/* ========================================
   CSS VARIABLES
   ======================================== */

:root {
    /* Colors */
    --primary: #6366F1;
    --primary-light: #818CF8;
    --primary-dark: #4F46E5;
    --success: #10B981;
    --success-light: #34D399;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    
    /* Backgrounds */
    --bg-page: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-sidebar: #1E293B;
    --bg-sidebar-hover: #334155;
    --bg-light: #F1F5F9;
    
    /* Text */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-light: #CBD5E1;
    --text-inverse: #FFFFFF;
    
    /* Borders */
    --border-light: #E2E8F0;
    --border-default: #CBD5E1;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* ========================================
   RESET & BASE
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

/* ========================================
   LAYOUT
   ======================================== */

.admin-container {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--bg-sidebar);
    padding: var(--space-4) 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 0 var(--space-4) var(--space-4);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-inverse);
    background: linear-gradient(135deg, var(--primary-light), #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: var(--space-1);
}

.nav-section {
    padding: 0 var(--space-3);
    margin-bottom: var(--space-5);
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.4);
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    margin-bottom: var(--space-1);
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-inverse);
}

.nav-item.active {
    background: var(--primary);
    color: var(--text-inverse);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: inherit;
    text-decoration: none;
    width: 100%;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: var(--space-6);
    min-height: 100vh;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: var(--space-3);
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    color: var(--text-inverse);
    background: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-light);
}

.btn-success {
    color: var(--text-inverse);
    background: var(--success);
}

.btn-danger {
    color: var(--text-inverse);
    background: var(--danger);
}

.btn-danger:hover {
    background: #DC2626;
}

/* ========================================
   STATS CARDS
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-surface);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.stat-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.stat-card-title {
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    font-size: 18px;
}

.stat-card-icon.users { background: #DBEAFE; color: #2563EB; }
.stat-card-icon.listings { background: #DCFCE7; color: #16A34A; }
.stat-card-icon.bookings { background: #FEF3C7; color: #D97706; }
.stat-card-icon.messages { background: #F3E8FF; color: #9333EA; }

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card-change {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* ========================================
   SECTIONS
   ======================================== */

.section {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    margin-bottom: var(--space-6);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
}

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-content {
    padding: var(--space-5);
}

/* ========================================
   FILTERS
   ======================================== */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.filter-group label {
    font-size: 12px;
    color: var(--text-secondary);
}

.filter-group select,
.filter-group input {
    padding: var(--space-2) var(--space-3);
    font-size: 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    min-width: 150px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ========================================
   TABLES
   ======================================== */

.activity-table {
    width: 100%;
    border-collapse: collapse;
}

.activity-table th,
.activity-table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.activity-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-light);
}

.activity-table tr:hover {
    background: var(--bg-light);
}

/* Activity Types */
.activity-type {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.activity-type.login { background: #DBEAFE; color: #1D4ED8; }
.activity-type.logout { background: #F1F5F9; color: #475569; }
.activity-type.register { background: #DCFCE7; color: #16A34A; }
.activity-type.listing_create { background: #FEF3C7; color: #D97706; }
.activity-type.listing_update { background: #F3E8FF; color: #9333EA; }
.activity-type.listing_delete { background: #FEE2E2; color: #DC2626; }
.activity-type.booking_create { background: #CFFAFE; color: #0891B2; }
.activity-type.booking_confirm { background: #D1FAE5; color: #059669; }
.activity-type.booking_cancel { background: #FEE2E2; color: #DC2626; }
.activity-type.booking_reject { background: #FCE7F3; color: #DB2777; }
.activity-type.message_send { background: #E0E7FF; color: #4F46E5; }
.activity-type.child_add { background: #FEF9C3; color: #CA8A04; }
.activity-type.child_delete { background: #FFEDD5; color: #EA580C; }
.activity-type.review_add { background: #FDE68A; color: #D97706; }
.activity-type.reminder_add { background: #BFDBFE; color: #2563EB; }
.activity-type.reminder_complete { background: #BBF7D0; color: #16A34A; }
.activity-type.profile_update { background: #E9D5FF; color: #9333EA; }
.activity-type.email_verify { background: #BBF7D0; color: #16A34A; }
.activity-type.password_reset { background: #FED7AA; color: #EA580C; }
.activity-type.admin_user_role_update { background: #FECACA; color: #DC2626; }

.activity-details {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-time {
    font-size: 13px;
    color: var(--text-muted);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.user-email {
    font-size: 12px;
    color: var(--text-muted);
}

/* ========================================
   TABS
   ======================================== */

.tabs {
    display: flex;
    gap: var(--space-1);
    padding: var(--space-1);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
}

.tab {
    padding: var(--space-2) var(--space-4);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--text-primary);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   PAGINATION
   ======================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-light);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    gap: var(--space-2);
}

.pagination-btn {
    padding: var(--space-2) var(--space-4);
    font-size: 14px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-light);
    color: var(--text-primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   LOADING & EMPTY STATES
   ======================================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-5);
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

/* ========================================
   REAL-TIME INDICATOR
   ======================================== */

.realtime-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--text-muted);
}

.realtime-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   MODAL
   ======================================== */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-1);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-light);
}

/* ========================================
   TOGGLE SWITCH
   ======================================== */

.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background-color: var(--border-default);
    border-radius: 28px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius-md);
    animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   FORM GROUPS
   ======================================== */

.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.form-group select,
.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--space-3);
    font-size: 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        margin-left: 220px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        padding: var(--space-4);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group select,
    .filter-group input {
        width: 100%;
        min-width: 0;
    }
    
    .header {
        flex-direction: column;
        gap: var(--space-4);
        align-items: flex-start;
    }
    
    .pagination {
        flex-direction: column;
        gap: var(--space-4);
    }
    
    .activity-table {
        font-size: 13px;
    }
    
    .activity-table th,
    .activity-table td {
        padding: var(--space-2);
    }
}

/* ========================================
   HIGH CONTRAST
   ======================================== */

@media (prefers-contrast: high) {
    .sidebar {
        background: #000;
    }
    
    .stat-card,
    .section {
        border: 2px solid var(--text-primary);
    }
}
