/**
 * Student Homepage Widgets - Unified Styles
 * Common styles for Current Lesson and Today's Lessons widgets
 * 
 * CSS prefix: shw- (Student Homepage Widgets)
 * 
 * @author selcukmart <admin@hostingdevi.com>
 * @version 2.0.0
 * @date 18.01.2026
 */

/* ========================================
   BASE STYLES & RESET
   ======================================== */

.shw-portlet {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.shw-portlet * {
    box-sizing: border-box;
}

/* ========================================
   PORTLET CUSTOMIZATIONS
   ======================================== */

.shw-portlet .portlet-title {
    padding: 12px 15px;
    min-height: auto;
    border-radius: 4px 4px 0 0;
}

.shw-portlet .portlet-title .caption {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    color: #fff;
}

.shw-portlet .portlet-title .caption > i {
    font-size: 18px;
    color: #fff !important;
}

.shw-portlet .portlet-title .caption-subject {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.shw-portlet .portlet-title .tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shw-portlet .portlet-title .tools > a {
    color: rgba(255, 255, 255, 0.8);
}

.shw-portlet .portlet-title .tools > a:hover {
    color: #fff;
}

.shw-portlet .portlet-body {
    padding: 0;
    background: #fff;
}

/* Header Variants */
.shw-portlet.shw-variant-current .portlet-title {
    background: linear-gradient(135deg, #36b37e 0%, #00875a 100%);
}

.shw-portlet.shw-variant-schedule .portlet-title {
    background: linear-gradient(135deg, #0052cc 0%, #0747a6 100%);
}

/* ========================================
   BADGE STYLES
   ======================================== */

.shw-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.shw-badge i {
    font-size: 10px;
}

.shw-badge-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    margin-left: 10px;
}

.shw-badge-time {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
}

.shw-badge-active {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.shw-badge-upcoming {
    background: #e7f1ff;
    color: #0052cc;
    border: 1px solid #b3d4ff;
}

.shw-badge-private {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.shw-badge-online {
    background: #e8f4fd;
    color: #0747a6;
    border: 1px solid #b3d4ff;
}

/* ========================================
   LESSON CARD STYLES
   ======================================== */

.shw-lesson-list {
    padding: 12px;
}

.shw-lesson-card {
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid #6c757d;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.shw-lesson-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Card Status Variants */
.shw-lesson-card.shw-status-active {
    border-left-color: #28a745;
    background: linear-gradient(135deg, #f0fff4 0%, #dcffe4 100%);
}

.shw-lesson-card.shw-status-upcoming {
    border-left-color: #0052cc;
    background: #f8f9fa;
}

.shw-lesson-card.shw-status-completed {
    border-left-color: #6c757d;
    background: #f1f3f5;
    opacity: 0.8;
}

/* Card Header */
.shw-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    gap: 10px;
    flex-wrap: wrap;
}

.shw-card-title {
    flex: 1;
    min-width: 150px;
}

.shw-card-title h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.shw-card-subtitle {
    font-size: 12px;
    color: #6c757d;
}

.shw-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Card Body */
.shw-card-body {
    padding: 0 15px 12px 15px;
}

/* Detail Row */
.shw-detail-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
}

.shw-detail-row:last-child {
    border-bottom: none;
}

.shw-detail-row i {
    width: 22px;
    font-size: 13px;
    color: #adb5bd;
    text-align: center;
}

.shw-detail-row span {
    flex: 1;
}

/* Time Display */
.shw-time-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    min-width: 100px;
}

.shw-time-start {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.shw-time-separator {
    font-size: 12px;
    color: #adb5bd;
}

.shw-time-end {
    font-size: 14px;
    color: #6c757d;
}

/* ========================================
   ATTENDANCE SECTION
   ======================================== */

.shw-attendance-section {
    padding: 12px 15px;
    background: #fff;
    border-top: 1px solid #e9ecef;
}

.shw-attendance-status {
    text-align: center;
    margin-bottom: 12px;
}

.shw-status-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.shw-status-box i {
    font-size: 16px;
}

.shw-status-pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.shw-status-present {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.shw-status-absent {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Attendance Buttons */
.shw-attendance-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.shw-btn-attendance {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 10px;
    border: 2px solid;
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.shw-btn-attendance i {
    font-size: 20px;
    margin-bottom: 6px;
}

.shw-btn-present {
    color: #28a745;
    border-color: #28a745;
}

.shw-btn-present:hover:not(:disabled) {
    background: #28a745;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.shw-btn-present.shw-selected {
    background: #28a745;
    color: #fff;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.shw-btn-absent {
    color: #dc3545;
    border-color: #dc3545;
}

.shw-btn-absent:hover:not(:disabled) {
    background: #dc3545;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.shw-btn-absent.shw-selected {
    background: #dc3545;
    color: #fff;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.shw-btn-attendance:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading state */
.shw-btn-attendance.shw-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.shw-btn-attendance.shw-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: shw-spin 0.8s linear infinite;
}

/* ========================================
   ONLINE LESSON SECTION
   ======================================== */

.shw-online-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: linear-gradient(135deg, #e8f4fd 0%, #dbeafe 100%);
    border-top: 1px solid #b3d4ff;
    gap: 10px;
    flex-wrap: wrap;
}

.shw-online-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #0747a6;
    font-size: 13px;
    font-weight: 500;
}

.shw-online-label i {
    font-size: 14px;
}

.shw-online-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.shw-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
}

.shw-btn i {
    font-size: 12px;
}

.shw-btn-join {
    background: #0052cc;
    color: #fff;
}

.shw-btn-join:hover {
    background: #0747a6;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 82, 204, 0.4);
}

.shw-btn-copy {
    background: #fff;
    color: #495057;
    border: 1px solid #dee2e6;
}

.shw-btn-copy:hover {
    background: #f1f3f5;
    border-color: #adb5bd;
}

.shw-btn-copy.shw-copied {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

/* ========================================
   LOCATION SECTION
   ======================================== */

.shw-location-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    font-size: 12px;
    color: #856404;
}

.shw-location-warning i {
    font-size: 14px;
    margin-top: 2px;
}

.shw-location-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    background: #e3f2fd;
    border-radius: 6px;
    font-size: 12px;
    color: #1565c0;
}

.shw-location-actions {
    margin-top: 10px;
    text-align: center;
}

.shw-btn-location {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #17a2b8;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.shw-btn-location:hover {
    background: #138496;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.shw-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.shw-empty-icon {
    font-size: 48px;
    color: #dee2e6;
    margin-bottom: 15px;
}

.shw-empty-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 500;
    color: #6c757d;
}

.shw-empty-text {
    margin: 0;
    font-size: 13px;
    color: #adb5bd;
}

.shw-btn-refresh {
    margin-top: 15px;
    padding: 8px 20px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.shw-btn-refresh:hover {
    background: #0056b3;
}

/* ========================================
   COMPACT EMPTY STATE
   ======================================== */

.shw-empty-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 25px 15px;
    color: #6c757d;
    font-size: 14px;
}

.shw-empty-compact i {
    font-size: 20px;
    color: #adb5bd;
}

/* ========================================
   COUNTDOWN TIMER
   ======================================== */

.shw-countdown {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #6c757d;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 10px;
    border-radius: 12px;
}

.shw-countdown i {
    font-size: 11px;
}

.shw-countdown.shw-ending-soon {
    color: #dc3545;
    background: #f8d7da;
}

/* ========================================
   PULSE INDICATOR
   ======================================== */

.shw-pulse-indicator {
    width: 10px;
    height: 10px;
    background: #28a745;
    border-radius: 50%;
    animation: shw-pulse 2s ease-in-out infinite;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes shw-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes shw-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

@keyframes shw-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shw-lesson-card {
    animation: shw-fadeIn 0.4s ease-out;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

@media (max-width: 768px) {
    .shw-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .shw-card-badges {
        width: 100%;
    }
    
    .shw-online-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .shw-online-actions {
        width: 100%;
    }
    
    .shw-btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .shw-portlet .portlet-title {
        padding: 10px 12px;
    }
    
    .shw-portlet .portlet-title .caption-subject {
        font-size: 14px;
    }
    
    .shw-lesson-list {
        padding: 8px;
    }
    
    .shw-card-header {
        padding: 10px 12px;
    }
    
    .shw-card-title h4 {
        font-size: 14px;
    }
    
    .shw-card-body {
        padding: 0 12px 10px 12px;
    }
    
    .shw-attendance-section {
        padding: 10px 12px;
    }
    
    .shw-attendance-buttons {
        gap: 8px;
    }
    
    .shw-btn-attendance {
        padding: 12px 8px;
    }
    
    .shw-btn-attendance i {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .shw-empty-state {
        padding: 30px 15px;
    }
    
    .shw-empty-icon {
        font-size: 40px;
    }
}

@media (max-width: 360px) {
    .shw-attendance-buttons {
        grid-template-columns: 1fr;
    }
    
    .shw-btn-attendance {
        flex-direction: row;
        gap: 10px;
    }
    
    .shw-btn-attendance i {
        margin-bottom: 0;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-contrast: high) {
    .shw-lesson-card {
        border-width: 2px;
    }
    
    .shw-btn-attendance,
    .shw-btn {
        border-width: 2px;
    }
    
    .shw-status-box {
        border-width: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .shw-lesson-card,
    .shw-btn-attendance,
    .shw-btn,
    .shw-pulse-indicator {
        animation: none;
        transition: none;
    }
    
    .shw-btn:hover,
    .shw-btn-attendance:hover {
        transform: none;
    }
}
