/**
 * Common Components for SnappyCards
 * Shared CSS components used across all pages
 */

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #7c3aed;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error & Success Messages */
.error-message, .success-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 500;
    margin: 1rem 0;
}

.error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fca5a5;
    color: #dc2626;
}

.success-message {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    color: #16a34a;
}

.error-message.warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fbbf24;
    color: #d97706;
}

.error-icon, .success-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Form Components */
.form-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-input.error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-input.success {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* Button Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #374151;
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.6);
}

/* Card Components */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.card-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.card-body {
    color: #374151;
    line-height: 1.6;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(226, 232, 240, 0.5);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Navigation Components */
.nav-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.nav-breadcrumb a {
    color: #7c3aed;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-breadcrumb a:hover {
    color: #5b21b6;
}

.nav-breadcrumb .separator {
    color: #9ca3af;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }

.hidden { display: none; }
.visible { display: block; }

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive utilities */
@media (max-width: 768px) {
    .form-container {
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .btn {
        padding: 0.875rem 1.25rem;
    }
    
    .card {
        padding: 1rem;
        border-radius: 12px;
    }
}

/* Loading states */
.loading .form-input,
.loading .btn {
    pointer-events: none;
    opacity: 0.7;
}

.has-error .form-input {
    border-color: #dc2626;
}

.has-success .form-input {
    border-color: #16a34a;
}

/* ==========================================
   ADMIN DASHBOARD COMPONENTS
   ========================================== */

/* Modal Components */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal.large {
    max-width: 900px;
    width: 95%;
}

.modal-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

.modal h2 {
    margin: 0 0 20px 0;
    color: #1e293b;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    border-bottom: 2px solid rgba(99, 102, 241, 0.1);
    padding-bottom: 12px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Stats Cards */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #6366f1;
    margin-bottom: 8px;
}

.stat-label {
    color: #64748b;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Teacher/Item Cards */
.teacher-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.teacher-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.teacher-card:last-child {
    margin-bottom: 0;
}

.teacher-info {
    flex: 1;
}

.teacher-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.teacher-email {
    font-size: 0.875rem;
    color: #64748b;
}

.teacher-note {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 4px;
    font-style: italic;
}

.teacher-status {
    margin: 0 16px;
}

.teacher-actions {
    display: flex;
    gap: 8px;
}

/* Action Buttons */
.action-btn {
    padding: 8px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn.edit {
    background: #f1f5f9;
    color: #64748b;
}

.action-btn.edit:hover {
    background: #e2e8f0;
    color: #475569;
}

.action-btn.archive {
    background: #fef3c7;
    color: #d97706;
}

.action-btn.archive:hover {
    background: #fde68a;
    color: #b45309;
}

.action-btn.activate {
    background: #dcfce7;
    color: #16a34a;
}

.action-btn.activate:hover {
    background: #bbf7d0;
    color: #15803d;
}

.action-btn.delete {
    background: #fee2e2;
    color: #dc2626;
}

.action-btn.delete:hover {
    background: #fecaca;
    color: #b91c1c;
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: #dcfce7;
    color: #16a34a;
}

.status-archived {
    background: #f3f4f6;
    color: #6b7280;
}

/* Filter Buttons */
.filter-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    color: #6b7280;
}

.filter-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.filter-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .modal {
        width: 95vw;
        height: 85vh;
        padding: 20px;
        margin: 0;
    }
    
    .modal.large {
        width: 95vw;
        height: 85vh;
    }
    
    .modal h2 {
        font-size: 20px;
    }
    
    .modal-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .teacher-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }
    
    .teacher-actions {
        width: 100%;
        justify-content: flex-end;
    }
}