/**
 * css/coaching-theme.css
 * 
 * Styles for coaching center multi-tenant system
 * Includes context switcher, branding overrides, and permission-based UI elements
 */

/* Context Badge in Banner */
.context-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(135deg, #5b7c99 0%, #7a9bb8 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 1rem;
}

.context-badge.individual {
    background: linear-gradient(135deg, #6c757d 0%, #868e96 100%);
}

.context-badge.coaching {
    background: linear-gradient(135deg, #5b7c99 0%, #7a9bb8 100%);
}

.context-badge i {
    font-size: 0.9rem;
}

/* Coaching Center Branding Override */
.coaching-branding {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.coaching-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
}

.coaching-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--coaching-brand-color, #5b7c99);
}

/* Permission-based UI Elements */
.requires-permission {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.requires-permission::after {
    content: 'No Permission';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
}

.requires-permission:hover::after {
    opacity: 1;
}

/* Hidden elements based on permissions */
.permission-hidden {
    display: none !important;
}

/* Access Denied Page */
.access-denied-container {
    max-width: 600px;
    margin: 100px auto;
    padding: 2rem;
    text-align: center;
}

.access-denied-icon {
    font-size: 5rem;
    color: #e74c3c;
    margin-bottom: 1rem;
}

.access-denied-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2c4e60;
    margin-bottom: 1rem;
}

.access-denied-message {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.access-denied-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-back {
    padding: 0.75rem 1.5rem;
    background: #5b7c99;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #4a6a85;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 124, 153, 0.3);
}

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.admin {
    background: #fee;
    color: #e74c3c;
}

.role-badge.teacher {
    background: #e3f2fd;
    color: #2196f3;
}

.role-badge.accountant {
    background: #e8f5e9;
    color: #4caf50;
}

.role-badge.receptionist {
    background: #fff3e0;
    color: #ff9800;
}

.role-badge.content_manager {
    background: #f3e5f5;
    color: #9c27b0;
}

/* Permission Matrix Table */
.permission-matrix {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.permission-matrix th {
    background: #f8fafc;
    color: #2c4e60;
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid #e0e4e8;
}

.permission-matrix td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f2f5;
}

.permission-matrix tr:last-child td {
    border-bottom: none;
}

.permission-matrix tr:hover {
    background: #f8fafc;
}

.permission-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.permission-module-header {
    background: #e8f4f8 !important;
    font-weight: 700;
    color: #5b7c99;
}

/* Staff Card */
.staff-card {
    background: white;
    border: 1px solid #e0e4e8;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.staff-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.staff-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.staff-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.staff-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5b7c99 0%, #7a9bb8 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
}

.staff-details h4 {
    margin: 0 0 0.25rem 0;
    color: #2c4e60;
    font-size: 1.1rem;
}

.staff-details p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.staff-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: 1px solid #e0e4e8;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5b7c99;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #5b7c99;
    color: white;
    border-color: #5b7c99;
}

.btn-icon.danger:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

/* Subject Access Pills */
.subject-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.subject-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #e8f4f8;
    color: #5b7c99;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.subject-pill.all-subjects {
    background: #e8f5e9;
    color: #4caf50;
}

/* Coaching Dashboard Cards */
.coaching-stat-card {
    background: white;
    border: 1px solid var(--border-color, #e0e4e8);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow, 0 2px 12px rgba(0,0,0,0.08));
    position: relative;
    overflow: hidden;
}

.coaching-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color, #5b7c99), var(--primary-hover, #4a6a85));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.coaching-stat-card:hover::before {
    transform: scaleX(1);
}

.coaching-stat-card:hover {
    box-shadow: var(--card-shadow-hover, 0 8px 24px rgba(0,0,0,0.12));
    transform: translateY(-6px);
    border-color: var(--primary-color, #5b7c99);
}

.coaching-stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
}

.coaching-stat-icon.blue {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
}

.coaching-stat-icon.green {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
}

.coaching-stat-icon.orange {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.coaching-stat-icon.purple {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
}

.coaching-stat-icon.teal {
    background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
}

.coaching-stat-content h3 {
    margin: 0 0 0.25rem 0;
    font-size: 2rem;
    font-weight: 700;
    color: #2c4e60;
}

.coaching-stat-content p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .context-switcher {
        margin: 0 0.5rem;
    }

    .current-context-btn {
        min-width: 140px;
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    .context-name {
        max-width: 100px;
    }

    .coaching-stat-card {
        padding: 1rem;
    }

    .coaching-stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .coaching-stat-content h3 {
        font-size: 1.5rem;
    }
}

/* Coaching Center Selector (for login) */
.coaching-selector {
    margin: 1rem 0;
}

.coaching-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c4e60;
}

.coaching-selector select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    font-size: 1rem;
    color: #2c4e60;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.coaching-selector select:focus {
    outline: none;
    border-color: #5b7c99;
    box-shadow: 0 0 0 3px rgba(91, 124, 153, 0.1);
}

/* Permission Info Banner */
.permission-info {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.permission-info-icon {
    font-size: 1.5rem;
    color: #ff9800;
}

.permission-info-text {
    flex: 1;
    color: #856404;
    font-size: 0.9rem;
}

/* Coaching Center Logo in Banner */
.banner-coaching-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    margin-right: 0.5rem;
}

/* Context Indicator */
.context-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    background: rgba(91, 124, 153, 0.1);
    border-radius: 16px;
    font-size: 0.85rem;
    color: #5b7c99;
    font-weight: 500;
}

.context-indicator i {
    font-size: 0.9rem;
}

/* Subject Access Indicator */
.subject-access-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: #e8f4f8;
    border: 1px solid #b3d9e6;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #5b7c99;
    margin-left: 0.5rem;
}

.subject-access-indicator.restricted {
    background: #fff3e0;
    border-color: #ffcc80;
    color: #f57c00;
}

/* Coaching Dashboard Grid */
.coaching-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

/* Staff Management Table */
.staff-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.staff-table th {
    background: #f8fafc;
    color: #2c4e60;
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid #e0e4e8;
}

.staff-table td {
    padding: 1rem;
    border-bottom: 1px solid #f0f2f5;
}

.staff-table tr:last-child td {
    border-bottom: none;
}

.staff-table tr:hover {
    background: #f8fafc;
}

/* Coaching Center Card (for selection/listing) */
.coaching-card {
    background: white;
    border: 2px solid #e0e4e8;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.coaching-card:hover {
    border-color: #5b7c99;
    box-shadow: 0 4px 12px rgba(91, 124, 153, 0.2);
    transform: translateY(-2px);
}

.coaching-card.selected {
    border-color: #5b7c99;
    background: #f8fafc;
}

.coaching-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.coaching-card-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8fafc;
    padding: 0.5rem;
}

.coaching-card-info h3 {
    margin: 0 0 0.25rem 0;
    color: #2c4e60;
    font-size: 1.2rem;
}

.coaching-card-info p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.coaching-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #666;
}

.coaching-card-meta i {
    color: #5b7c99;
    margin-right: 0.25rem;
}

/* Module Access Grid */
.module-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.module-access-card {
    background: white;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.module-access-card.enabled {
    border-color: #4caf50;
    background: #f1f8f4;
}

.module-access-card.disabled {
    opacity: 0.5;
}

.module-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    background: linear-gradient(135deg, #5b7c99 0%, #7a9bb8 100%);
}

.module-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    color: #2c4e60;
}

.module-info p {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .coaching-dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .coaching-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .module-access-grid {
        grid-template-columns: 1fr;
    }

    .staff-table {
        font-size: 0.9rem;
    }

    .staff-table th,
    .staff-table td {
        padding: 0.75rem;
    }
}
