/* Custom styles */
@import url('https://fonts.googleapis.com/css2?family=Andika:wght@700&display=swap');

/* Dashboard Card Styles */
.dashboard-card {
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.dashboard-card:hover::before {
    left: 100%;
}

.dashboard-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dashboard-card:hover::after {
    opacity: 1;
}

/* Icon animation */
.dashboard-card i {
    transition: transform 0.3s ease, filter 0.3s ease;
}

.dashboard-card:hover i {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

/* Pulse animation for dashboard cards */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.dashboard-card:hover {
    animation: pulse 1.5s infinite;
}

/* Loading animation for dashboard */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-card {
    animation: fadeInUp 0.6s ease-out;
}

.dashboard-card:nth-child(1) { animation-delay: 0.1s; }
.dashboard-card:nth-child(2) { animation-delay: 0.2s; }
.dashboard-card:nth-child(3) { animation-delay: 0.3s; }
.dashboard-card:nth-child(4) { animation-delay: 0.4s; }
.dashboard-card:nth-child(5) { animation-delay: 0.5s; }
.dashboard-card:nth-child(6) { animation-delay: 0.6s; }

/* Mobile responsiveness for dashboard cards */
@media (max-width: 768px) {
    .dashboard-card {
        transform: scale(0.95);
    }
    
    .dashboard-card:hover {
        transform: scale(1.02);
    }
    
    .dashboard-card i {
        font-size: 3rem !important;
    }
    
    .dashboard-card h3 {
        font-size: 1.1rem !important;
    }
    
    .dashboard-card p {
        font-size: 0.8rem !important;
    }
}

body {
    margin: 0;
    padding: 0;
}

/* Andika Bold font for flashcard words */
.word-item p {
    font-family: 'Andika', sans-serif;
    font-weight: 700;
}

/* Responsive grid for words */
#wordsGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    #wordsGrid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .word-item {
        padding: 0.5rem;
    }
    .word-item img {
        height: 100px;
    }
}

/* Add this to your CSS file */
#wordsGrid {
    transition: opacity 0.3s ease-in-out;
}

.word-item {
    min-height: 200px; /* Adjust based on your design */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.word-item img {
    flex-shrink: 0; /* Prevent image from shrinking */
}

/* Smooth loading state */
.words-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Weekly Schedule Table Mobile Responsiveness */
@media (max-width: 768px) {
    #weeklyScheduleTable {
        font-size: 0.875rem; /* Reduce font size for mobile */
    }
    #weeklyScheduleTable th,
    #weeklyScheduleTable td {
        padding: 0.5rem; /* Adjust padding in table cells for mobile */
    }
}

/* Students Table Mobile Responsiveness */
@media (max-width: 768px) {
    #studentsTable {
        font-size: 0.875rem; /* Reduce font size for mobile */
    }
    #studentsTable th,
    #studentsTable td {
        padding: 0.5rem; /* Adjust padding in table cells for mobile */
    }
}

/* Schedule Form and Modal Mobile Responsiveness */
@media (max-width: 768px) {
    #editScheduleModal .relative {
        width: 90%;
        max-width: none;
    }
    #createScheduleForm {
        flex-direction: column;
    }
    #createScheduleForm select,
    #createScheduleForm input,
    #createScheduleForm button {
        width: 100%;
    }
    #editScheduleForm {
        flex-direction: column;
    }
    #editScheduleForm select,
    #editScheduleForm input {
        width: 100%;
    }
}

/* Admin Schedule Filter Section Mobile Responsiveness */
@media (max-width: 768px) {
    .bg-blue-50.border.border-blue-200 {
        padding: 1rem !important;
    }
    
    .bg-blue-50.border.border-blue-200 .flex {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }
    
    .bg-blue-50.border.border-blue-200 .flex .flex {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }
    
    .bg-blue-50.border.border-blue-200 label {
        margin-bottom: 0.25rem;
    }
    
    .bg-blue-50.border.border-blue-200 input[type="date"],
    .bg-blue-50.border.border-blue-200 select {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .bg-blue-50.border.border-blue-200 .flex.gap-2 {
        flex-direction: row !important;
        justify-content: stretch !important;
        margin-top: 0.5rem;
    }
    
    .bg-blue-50.border.border-blue-200 .flex.gap-2 button {
        flex: 1 !important;
    }
    
    .bg-blue-50.border.border-blue-200 span.text-gray-500 {
        text-align: center;
        margin: 0.25rem 0;
    }
}

/* Enhanced mobile responsiveness for very narrow screens (480px and below) */
@media (max-width: 480px) {
    .bg-blue-50.border.border-blue-200 {
        padding: 0.75rem !important;
    }
    
    /* Main filter container */
    .bg-blue-50.border.border-blue-200 > .flex:first-child {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    
    /* Individual filter groups */
    .bg-blue-50.border.border-blue-200 .flex.items-center.gap-2 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    
    /* Date range specific adjustments - ensure stacking */
    .bg-blue-50 #filterStartDate,
    .bg-blue-50 #filterEndDate {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 44px !important; /* Better touch target for mobile */
        font-size: 16px !important; /* Prevent zoom on iOS */
        box-sizing: border-box !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Labels for filters */
    .bg-blue-50.border.border-blue-200 label {
        display: block !important;
        margin-bottom: 0.25rem !important;
        font-weight: 600 !important;
    }
    
    /* "to" span and its container */
    .bg-blue-50 .flex.items-center.justify-center.gap-2 {
        width: 100% !important;
        margin-top: 0.5rem !important;
    }
    
    .bg-blue-50 .flex.items-center.justify-center.gap-2 span.text-gray-500 {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        font-weight: 500 !important;
    }
    
    /* On very narrow screens, stack the "to" and end date vertically if needed */
    @media (max-width: 360px) {
        .bg-blue-50 .flex.items-center.justify-center.gap-2 {
            flex-direction: column !important;
            align-items: stretch !important;
            gap: 0.25rem !important;
        }
        
        .bg-blue-50 .flex.items-center.justify-center.gap-2 span.text-gray-500 {
            text-align: center !important;
            order: 2 !important;
        }
        
        .bg-blue-50 #filterEndDate {
            order: 1 !important;
            margin-bottom: 0 !important;
        }
    }
    
    /* Button container */
    .bg-blue-50.border.border-blue-200 .flex.gap-2.ml-auto {
        flex-direction: row !important;
        margin-left: 0 !important;
        margin-top: 0.5rem !important;
        gap: 0.5rem !important;
    }
    
    .bg-blue-50.border.border-blue-200 .flex.gap-2.ml-auto button {
        flex: 1 !important;
        min-height: 44px !important; /* Better touch target */
        font-size: 14px !important;
    }
    
    /* Status indicators */
    .bg-blue-50.border.border-blue-200 .flex.items-center.gap-2:last-child {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.5rem !important;
        margin-top: 0.5rem !important;
    }
}

/* Mobile Schedule Table - Compact Card Layout */
@media (max-width: 768px) {
    /* Hide the desktop table on mobile */
    #scheduleTable {
        display: none;
    }
    
    /* Show mobile card container */
    #scheduleMobileContainer {
        display: block !important;
    }
    
    /* Mobile schedule cards - More compact */
    .schedule-card {
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        padding: 8px;
        margin-bottom: 8px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
        transition: all 0.2s ease;
    }
    
    .schedule-card:hover {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
        transform: translateY(-1px);
    }
    
    /* Card header with class name and status - Reduced spacing */
    .schedule-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 6px;
        gap: 6px;
    }
    
    .schedule-card-class {
        flex: 1;
        font-weight: 600;
        font-size: 13px;
        color: #1f2937;
        line-height: 1.2;
        word-wrap: break-word;
    }
    
    .schedule-card-status {
        flex-shrink: 0;
    }
    
    /* Card body with date and fee - More compact */
    .schedule-card-body {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
        gap: 6px;
    }
    
    .schedule-card-date {
        font-size: 12px;
        color: #6b7280;
        display: flex;
        align-items: center;
        gap: 3px;
        flex: 1;
    }
    
    .schedule-card-fee {
        font-size: 12px;
        color: #374151;
        font-weight: 500;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Card actions - Smaller buttons */
    .schedule-card-actions {
        display: flex;
        gap: 4px;
        flex-wrap: wrap;
        align-items: center;
    }
    
    .schedule-card-actions button {
        font-size: 11px;
        padding: 3px 6px;
        min-height: 28px;
        flex: 1;
        min-width: 50px;
    }
    
    /* Quick action buttons in class name - Slightly smaller */
    .quick-check-btn {
        background: #10b981 !important;
        color: white !important;
        border: none !important;
        border-radius: 3px !important;
        padding: 1px 4px !important;
        font-size: 10px !important;
        margin-left: 4px !important;
        cursor: pointer !important;
        transition: background-color 0.2s ease !important;
    }
    
    .quick-check-btn:hover {
        background: #059669 !important;
    }
    
    /* Status badges - More compact */
    .schedule-card-status .px-2 {
        padding: 1px 4px !important;
        font-size: 10px !important;
    }

    /* Ensure no horizontal overflow in cards */
    .schedule-card {
        overflow: hidden;
        word-wrap: break-word;
    }

    .schedule-card-header,
    .schedule-card-body {
        flex-wrap: wrap;
    }
}

/* Desktop styles - ensure mobile container is hidden */
@media (min-width: 769px) {
    #scheduleMobileContainer {
        display: none !important;
    }
}
