/**
 * Teacher Portal CSS
 * Main stylesheet for the Teacher Portal plugin
 *
 * @package Teacher_Portal
 * @version 1.0.0
 */

/* ==========================================================================
   Reset and Base Styles
   ========================================================================== */

.teacher-portal-wrapper * {
    box-sizing: border-box;
}

.teacher-portal-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    min-height: 100vh;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */

.teacher-portal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.teacher-portal-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2.5rem;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.teacher-info h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
    font-weight: 500;
}

.teacher-details {
    margin: 0.5rem 0;
    opacity: 0.9;
    font-size: 1rem;
}

.teacher-details span {
    margin-right: 1.5rem;
    display: inline-block;
}

.teacher-role {
    margin: 0.5rem 0;
}

.role-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-right: 0.5rem;
    display: inline-block;
    backdrop-filter: blur(10px);
}

/* ==========================================================================
   Grid Systems
   ========================================================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Cards and Containers
   ========================================================================== */

.dashboard-card,
.section-card,
.summary-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e5e9;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover,
.section-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.dashboard-card h3,
.section-card h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.card-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

/* ==========================================================================
   Statistics and Metrics
   ========================================================================== */

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.stat-item:hover {
    background: #e9ecef;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.3rem;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
}

.summary-icon {
    font-size: 2.5rem;
    margin-right: 1rem;
}

.summary-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #28a745;
    margin-bottom: 0.3rem;
}

.summary-label {
    color: #6c757d;
    font-size: 0.9rem;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-container {
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.95rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

/* Mark Entry Table Specific */
.marks-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin: 1rem 0;
}

.marks-table th,
.marks-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #e9ecef;
}

.marks-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    position: sticky;
    top: 0;
}

.student-row:hover {
    background: #f8f9fa;
}

.mark-field {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
    transition: border-color 0.2s ease;
}

.mark-field:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.25);
}

.medium-field {
    padding: 0.4rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* ==========================================================================
   Badges and Labels
   ========================================================================== */

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
}

.grade-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    min-width: 25px;
    text-align: center;
}

.grade-badge.grade-a {
    background: #d4edda;
    color: #155724;
}

.grade-badge.grade-b {
    background: #cce5ff;
    color: #004085;
}

.grade-badge.grade-c {
    background: #fff3cd;
    color: #856404;
}

.grade-badge.grade-s {
    background: #f8d7da;
    color: #721c24;
}

.grade-badge.grade-w {
    background: #f5c6cb;
    color: #721c24;
}

.gender-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.gender-badge.male {
    background: #cce5ff;
    color: #004085;
}

.gender-badge.female {
    background: #f8d7da;
    color: #721c24;
}

.subject-type-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.subject-type-badge.main {
    background: #e3f2fd;
    color: #1976d2;
}

.subject-type-badge.basket {
    background: #f3e5f5;
    color: #7b1fa2;
}

.payment-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e9ecef;
    color: #495057;
}

.payment-type-badge.monthly_payment {
    background: #d4edda;
    color: #155724;
}

.payment-type-badge.welfare_payment {
    background: #cce5ff;
    color: #004085;
}

.payment-type-badge.bonus_payment {
    background: #fff3cd;
    color: #856404;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.5;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
    text-decoration: none;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-icon {
    margin-right: 0.5rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.25);
}

.form-control:disabled {
    background-color: #e9ecef;
    opacity: 1;
}

select.form-control {
    background: white;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.bulk-actions {
    display: flex;
    gap: 0.5rem;
}

/* ==========================================================================
   Action Cards
   ========================================================================== */

.action-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e5e9;
    transition: all 0.2s ease;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: inherit;
}

.action-icon {
    font-size: 2rem;
    margin-right: 1rem;
}

.action-content h4 {
    margin: 0 0 0.3rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.action-content p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

/* ==========================================================================
   Progress and Grade Bars
   ========================================================================== */

.grade-distribution {
    margin-top: 1rem;
}

.grade-distribution h6 {
    margin: 0 0 0.5rem 0;
    color: #495057;
    font-size: 0.9rem;
    font-weight: 600;
}

.grade-bars {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.grade-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.grade-label {
    width: 20px;
    font-weight: bold;
    font-size: 0.8rem;
    text-align: center;
}

.grade-progress {
    flex: 1;
    height: 15px;
    background: #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.grade-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.3s ease;
}

.grade-fill.grade-a { background: #28a745; }
.grade-fill.grade-b { background: #17a2b8; }
.grade-fill.grade-c { background: #ffc107; }
.grade-fill.grade-s { background: #fd7e14; }
.grade-fill.grade-w { background: #dc3545; }

.grade-count {
    width: 30px;
    text-align: right;
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
}

/* ==========================================================================
   Messages and Alerts
   ========================================================================== */

.message {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.message-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
}

.message-content h4 {
    margin: 0 0 0.3rem 0;
}

.message-content p {
    margin: 0;
}

.success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.warning-message {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.info-message {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.teacher-portal-error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
    margin: 1rem 0;
}

/* ==========================================================================
   Navigation and Footer
   ========================================================================== */

.navigation-footer {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
}

.pagination-info {
    margin-top: 1.5rem;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* ==========================================================================
   Monthly Grid and Calendar Components
   ========================================================================== */

.monthly-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.month-card {
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.2s ease;
}

.month-card.has-payment {
    background: #d4edda;
    border-color: #28a745;
}

.month-card.no-payment {
    background: #f8f9fa;
    border-color: #e9ecef;
    opacity: 0.6;
}

.month-name {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.month-amount {
    font-size: 1.1rem;
    font-weight: 600;
    color: #28a745;
    margin-bottom: 0.3rem;
}

.month-card.no-payment .month-amount {
    color: #6c757d;
}

.month-count {
    font-size: 0.8rem;
    color: #6c757d;
}

/* ==========================================================================
   Student and Class Components
   ========================================================================== */

.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.student-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.student-card:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.student-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.student-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.student-index {
    color: #6c757d;
    font-size: 0.9rem;
}

.class-subjects-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
    margin-bottom: 1rem;
}

.class-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.class-header h4 {
    margin: 0;
    color: #2c3e50;
}

.class-grade {
    background: #17a2b8;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ==========================================================================
   Exam and Performance Components
   ========================================================================== */

.exam-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin: 1rem 0;
}

.exam-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.exam-header h5 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.exam-date {
    color: #6c757d;
    font-size: 0.9rem;
}

.exam-stats {
    margin-bottom: 1rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
}

.stat-value {
    font-weight: 600;
    color: #2c3e50;
}

.average-mark {
    color: #17a2b8;
}

.exam-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.no-data,
.no-payments {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.no-data-icon,
.no-payments-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-data h4,
.no-payments h4 {
    margin: 0 0 0.5rem 0;
    color: #495057;
    font-size: 1.2rem;
}

.no-data p,
.no-payments p {
    margin: 0;
    font-size: 1rem;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .exam-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .teacher-portal-wrapper {
        padding: 1rem;
    }
    
    .teacher-portal-header {
        padding: 1.5rem;
    }
    
    .teacher-portal-header h1 {
        font-size: 2rem;
    }
    
    .teacher-info h2 {
        font-size: 1.5rem;
    }
    
    .teacher-details span {
        display: block;
        margin-right: 0;
        margin-bottom: 0.25rem;
    }
    
    .dashboard-grid,
    .stats-grid,
    .actions-grid,
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .summary-card {
        flex-direction: column;
        text-align: center;
    }
    
    .summary-icon {
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .bulk-actions {
        width: 100%;
        justify-content: center;
    }
    
    .navigation-footer {
        flex-direction: column;
    }
    
    .monthly-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .students-grid {
        grid-template-columns: 1fr;
    }
    
    .exam-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .marks-table th,
    .marks-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.9rem;
    }
    
    .mark-field {
        width: 60px;
    }
    
    .action-card {
        flex-direction: column;
        text-align: center;
    }
    
    .action-icon {
        margin-right: 0;
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .teacher-portal-header h1 {
        font-size: 1.8rem;
    }
    
    .teacher-info h2 {
        font-size: 1.3rem;
    }
    
    .dashboard-card,
    .section-card,
    .summary-card {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .monthly-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .summary-value {
        font-size: 1.5rem;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .teacher-portal-wrapper {
        background: white;
    }
    
    .teacher-portal-header {
        background: #f8f9fa !important;
        color: #333 !important;
        box-shadow: none;
    }
    
    .btn,
    .navigation-footer,
    .form-actions {
        display: none;
    }
    
    .dashboard-card,
    .section-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for better accessibility */
.btn:focus,
.form-control:focus,
.action-card:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .teacher-portal-wrapper {
        background: white;
    }
    
    .dashboard-card,
    .section-card,
    .summary-card {
        border: 2px solid #333;
    }
    
    .btn-primary {
        background: #000;
        border: 2px solid #000;
    }
    
    .btn-outline {
        border: 2px solid #333;
    }
}