/* Admin Panel Styles */

/* Admin Header Card */
.page-header-card.admin-gradient {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    border-radius: 1.25rem;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    box-shadow: 0 10px 40px -10px rgba(99, 102, 241, 0.4);
}

.page-header-card.admin-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.page-header-card.admin-gradient::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.page-header-card.admin-gradient .page-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 200px;
    position: relative;
    z-index: 1;
}

.page-header-card.admin-gradient .page-header-icon {
    width: 56px;
    height: 56px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.page-header-card.admin-gradient .page-header-text {
    color: white;
}

.page-header-card.admin-gradient .page-header-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-header-card.admin-gradient .page-header-subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
    margin: 0;
}

/* Admin Header Stats */
.admin-header-stats {
    display: flex;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.admin-header-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.75rem;
    color: white;
    min-width: 70px;
}

.admin-header-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

.admin-header-stat-label {
    font-size: 0.6875rem;
    opacity: 0.85;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .page-header-card.admin-gradient {
        padding: 1.25rem;
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-header-card.admin-gradient .page-header-content {
        justify-content: center;
        text-align: center;
        flex-direction: column;
    }
    
    .admin-header-stats {
        justify-content: center;
    }
}

/* Legacy admin header - keep for compatibility */
.admin-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.dark .admin-title {
    color: #f1f5f9;
}

/* Summary Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.dark .stat-card {
    background: #1e293b;
    border-color: #334155;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.stat-icon.users {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.branches {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.logs {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-icon.active {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.dark .stat-value {
    color: #f1f5f9;
}

.stat-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.stat-trend.up {
    color: #10b981;
}

.stat-trend.down {
    color: #ef4444;
}

/* Admin Tabs */
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
}

.admin-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.dark .admin-tab {
    background: #1e293b;
    border-color: #334155;
}

.admin-tab:hover {
    border-color: #0ea5e9;
    color: #0ea5e9;
}

.admin-tab.active {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: white;
}

/* User Card */
.user-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-left: 3px solid transparent;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.dark .user-card {
    background: #1e293b;
    border-color: #334155;
}

.user-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.user-card[data-role="superadmin"] {
    border-left-color: #f59e0b;
}

.user-card[data-role="admin"] {
    border-left-color: #3b82f6;
}

.user-card[data-role="user"] {
    border-left-color: #10b981;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: #1e293b;
}

.dark .user-name {
    color: #f1f5f9;
}

.user-email {
    font-size: 0.875rem;
    color: #64748b;
}

.user-role {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-weight: 500;
}

.user-role.superadmin {
    background: #fef3c7;
    color: #92400e;
}

.user-role.admin {
    background: #dbeafe;
    color: #1e40af;
}

.user-role.user {
    background: #d1fae5;
    color: #065f46;
}

/* Branch Card */
.branch-card {
    padding: 1.25rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-top: 3px solid #0ea5e9;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.dark .branch-card {
    background: #1e293b;
    border-color: #334155;
}

.branch-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-top-color: #0284c7;
}

.branch-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.branch-name {
    font-weight: 600;
    color: #1e293b;
}

.dark .branch-name {
    color: #f1f5f9;
}

.branch-code {
    font-size: 0.75rem;
    color: #64748b;
    font-family: monospace;
}

.branch-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

.branch-detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Activity Log */
.log-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.dark .log-card {
    background: #1e293b;
    border-color: #334155;
}

.log-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateX(4px);
}

.log-card:last-child {
    margin-bottom: 0;
}

.log-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.dark .log-item {
    border-color: #334155;
}

.log-item:last-child {
    border-bottom: none;
}

.log-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.log-icon.login { background: #dbeafe; color: #2563eb; }
.log-icon.create { background: #d1fae5; color: #059669; }
.log-icon.update { background: #fef3c7; color: #d97706; }
.log-icon.delete { background: #fee2e2; color: #dc2626; }

.log-content {
    flex: 1;
}

.log-action {
    font-size: 0.875rem;
    color: #1e293b;
}

.dark .log-action {
    color: #f1f5f9;
}

.log-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* Grid Layouts */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
    width: 100%;
}

.branches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 1rem;
    width: 100%;
}

/* Admin Content Container */
#admin-content {
    width: 100%;
    overflow-x: hidden;
}

/* Utility Classes */
.space-y-3 > * + * {
    margin-top: 0.75rem;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .user-card {
        flex-wrap: wrap;
    }
    
    .user-card .flex.gap-1 {
        width: 100%;
        justify-content: flex-end;
    }
}


/* ========================================
   Mobile Responsive Enhancements
   ======================================== */

/* Small Mobile (< 480px) */
@media (max-width: 479px) {
    .page-header-card.admin-gradient {
        padding: 1rem;
    }
    
    .page-header-card.admin-gradient .page-header-icon {
        width: 44px;
        height: 44px;
    }
    
    .page-header-card.admin-gradient .page-header-title {
        font-size: 1.25rem;
    }
    
    .page-header-card.admin-gradient .page-header-subtitle {
        font-size: 0.8125rem;
    }
    
    .admin-header-stats {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .admin-header-stat {
        padding: 0.5rem 0.875rem;
        min-width: 60px;
    }
    
    .admin-header-stat-value {
        font-size: 1rem;
    }
    
    .admin-header-stat-label {
        font-size: 0.5625rem;
    }
    
    .stats-grid {
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .stat-icon {
        margin: 0 auto;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .admin-tabs {
        gap: 0.375rem;
        margin: 0 -0.75rem 1rem;
        padding: 0 0.75rem 0.75rem;
    }
    
    .admin-tab {
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
    }
    
    .user-card {
        padding: 0.875rem;
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .user-avatar {
        margin: 0 auto;
    }
    
    .user-card .flex.gap-1 {
        justify-content: center;
    }
    
    .branch-card {
        padding: 1rem;
    }
    
    .branch-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .log-card {
        padding: 0.875rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .log-icon {
        margin: 0;
    }
    
    .log-meta {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .users-grid,
    .branches-grid {
        grid-template-columns: 1fr;
    }
}
