/* SchoolManagementSystem/static/css/styles.css */

/* Custom gradient for header and sidebar - Attempting to match image_d4b542.jpg */
.bg-gradient-header {
    /* This gradient attempts to match the header in the provided screenshot */
    background-image: linear-gradient(to right, #2c3e50, #4a69bd);
    /* Dark blue to a slightly lighter blue/indigo */
}

.bg-gradient-sidebar {
    /* This gradient attempts to match the sidebar in the provided screenshot */
    background-image: linear-gradient(to bottom, #2c3e50, #34495e);
    /* Dark blue to a slightly darker blue/gray */
}

/* General Body and Font */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #f0f4f8;
    /* A light, clean background */
    -webkit-tap-highlight-color: transparent;
    /* Remove touch highlight on mobile */
}

/* Mobile Typography Scaling */
@media (max-width: 768px) {

    h1,
    .text-3xl {
        font-size: 1.5rem !important;
        line-height: 2rem !important;
    }

    h2,
    .text-2xl {
        font-size: 1.25rem !important;
        line-height: 1.75rem !important;
    }

    h3,
    .text-xl {
        font-size: 1.125rem !important;
        line-height: 1.5rem !important;
    }
}

/* Dashboard Card Styles (Common for many sections) */
.dashboard-card {
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Navigation Item Styles (Common for sidebars) */
.nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    /* py-2 px-3 */
    border-radius: 0.375rem;
    /* rounded-md */
    color: #4b5563;
    /* text-gray-700 */
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    /* Prevent text wrapping */
}

.nav-link:hover {
    background-color: #e5e7eb;
    /* hover:bg-gray-100 */
    color: #1f2937;
    /* hover:text-gray-900 */
    transform: translateX(2px);
    /* Subtle slide effect on hover */
}

.nav-link svg {
    flex-shrink: 0;
    /* Prevent icon from shrinking */
    margin-right: 0.75rem;
    /* space-x-3 equivalent */
}

/* Active navigation link styling - Adjusted for light theme */
.nav-link.active {
    background-color: #e0e7ff;
    /* Indigo-100 */
    color: #4f46e5;
    /* Indigo-600 for text */
    font-weight: 600;
    border-left: 4px solid #4f46e5;
    /* Indigo-600 accent border */
    padding-left: 12px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
    /* Subtle glow for active */
}

.nav-link.active svg {
    color: #4f46e5;
    /* Indigo-600 icon for active state */
}

/* Dropdown styles - Adjusted for light theme */
.dropdown-menu {
    display: none;
    position: absolute;
    background-color: #ffffff;
    /* White background */
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    border-radius: 0.375rem;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    border: 1px solid #e5e7eb;
    /* Light border */
}

.dropdown-menu.active {
    display: block;
}

.dropdown-menu a {
    color: #374151;
    /* Dark gray text */
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    border-radius: 0.375rem;
}

.dropdown-menu a:hover {
    background-color: #f3f4f6;
    /* Light gray hover */
}

/* Custom scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: #e0e7ff;
    /* Light blue track */
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: #6366f1;
    /* Indigo-500 */
    border-radius: 4px;
    border: 2px solid #e0e7ff;
}

/* Form Styling - General input fields */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    background-color: #ffffff;
    font-size: 0.875rem;
    line-height: 1.25rem;
    min-height: 2.5rem;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
select:focus,
textarea:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

input[type="checkbox"] {
    height: 1rem;
    width: 1rem;
    color: #4f46e5;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
}

input[type="checkbox"]:focus {
    box-shadow: 0 0 0 1px #6366f1;
}

/* Button Styling - Primary */
.btn-primary {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    color: #ffffff;
    background-color: #4f46e5;
    transition: background-color 150ms ease-in-out, box-shadow 150ms ease-in-out, border-color 150ms ease-in-out;
    cursor: pointer;
}
.btn-primary:hover {
    background-color: #4338ca;
}
.btn-primary:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #6366f1;
}

/* Button Styling - Secondary */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    color: #374151;
    background-color: #ffffff;
    transition: background-color 150ms ease-in-out, box-shadow 150ms ease-in-out, border-color 150ms ease-in-out;
    cursor: pointer;
}
.btn-secondary:hover {
    background-color: #f9fafb;
}
.btn-secondary:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #6366f1;
}

/* Button Styling - Danger */
.btn-danger {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    color: #ffffff;
    background-color: #dc2626;
    transition: background-color 150ms ease-in-out, box-shadow 150ms ease-in-out, border-color 150ms ease-in-out;
    cursor: pointer;
}
.btn-danger:hover {
    background-color: #b91c1c;
}
.btn-danger:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #ef4444;
}

/* Table Styling */
.table-auto {
    width: 100%;
    border-collapse: collapse;
}

.table-auto th,
.table-auto td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    /* gray-200 */
}

.table-auto th {
    background-color: #f9fafb;
    /* gray-50 */
    font-weight: 600;
    color: #374151;
    /* gray-700 */
    text-transform: uppercase;
    font-size: 0.75rem;
    /* text-xs */
    letter-spacing: 0.05em;
    /* tracking-wider */
}

.table-auto tbody tr:hover {
    background-color: #f3f4f6;
    /* gray-100 */
}

/* Pagination Styling */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.5rem;
}
.pagination > * + * {
    margin-left: 0.5rem;
}

.pagination a,
.pagination span {
    padding: 0.25rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
}

.pagination a:hover {
    background-color: #f3f4f6;
}

.pagination .current-page {
    background-color: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
}

.pagination .current-page:hover {
    background-color: #4338ca;
}

.pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Message Styles */
.message-success {
    background-color: #dcfce3;
    color: #166534;
}

.message-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.message-warning {
    background-color: #fef9c3;
    color: #854d0e;
}

.message-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-blue {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Blue-100 / Blue-800 */
.badge-green {
    background-color: #d1fae5;
    color: #065f46;
}

/* Green-100 / Green-800 */
.badge-yellow {
    background-color: #fef3c7;
    color: #92400e;
}

/* Yellow-100 / Yellow-800 */
.badge-red {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Red-100 / Red-800 */
.badge-purple {
    background-color: #f3e8ff;
    color: #6b21a8;
}

/* Purple-100 / Purple-800 */
.badge-indigo {
    background-color: #e0e7ff;
    color: #3730a3;
}

/* Indigo-100 / Indigo-800 */
.badge-orange {
    background-color: #ffedd5;
    color: #9a3412;
}

/* Orange-100 / Orange-800 */
.badge-pink {
    background-color: #fce7f3;
    color: #9d174d;
}

/* Pink-100 / Pink-800 */
.badge-gray {
    background-color: #f3f4f6;
    color: #4b5563;
}

/* Gray-100 / Gray-600 */

.teacher-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.print-button {
    transition: all 0.3s ease;
}

.print-button:hover {
    background-color: #2563eb;
}

/* Blue-700 */
.room-tag {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.6);
}

/* Routine Grid Layout */
.routine-grid {
    display: grid;
    grid-template-columns: 80px repeat(5, 1fr);
    /* Time column + 5 days */
    gap: 8px;
}

@media (max-width: 768px) {
    .routine-grid {
        grid-template-columns: 60px repeat(5, 1fr);
        gap: 4px;
    }

    .routine-cell {
        padding: 8px !important;
    }

    .subject-name {
        font-size: 12px !important;
    }

    .teacher-name {
        font-size: 10px !important;
    }

    .room-tag {
        font-size: 9px !important;
        padding: 1px 4px !important;
    }
}

.subject-name {
    font-weight: 500;
    font-size: 14px;
}

.teacher-name {
    font-size: 12px;
    color: #4b5563;
}

/* Gray-600 */
.time-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.time-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 8px;
    background-color: #f9fafb;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
}

.current-period {
    position: relative;
    overflow: hidden;
}

.current-period::after {
    content: 'Current';
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: #3b82f6;
    /* Blue-600 */
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    transform: rotate(0deg);
}

.legend-item {
    display: flex;
    align-items: center;
    margin-right: 12px;
    margin-bottom: 8px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 6px;
}

/* Exam reminder styles */
.exam-reminder {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    z-index: 50;
    transition: all 0.3s ease;
}

.exam-reminder.collapsed {
    width: 60px;
    height: 60px;
    overflow: hidden;
}

.exam-reminder-header {
    cursor: pointer;
}

.exam-item {
    border-left: 4px solid;
    transition: all 0.2s ease;
}

.exam-item:hover {
    transform: translateX(5px);
}

.exam-item.urgent {
    border-left-color: #ef4444;
}

/* Red-600 */
.exam-item.upcoming {
    border-left-color: #f59e0b;
}

/* Yellow-600 */
.exam-item.future {
    border-left-color: #3b82f6;
}

/* Blue-600 */

.exam-date {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.05);
}

.exam-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.exam-badge-urgent {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Red-100 / Red-800 */
.exam-badge-upcoming {
    background-color: #fef3c7;
    color: #92400e;
}

/* Yellow-100 / Yellow-800 */
.exam-badge-future {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Blue-100 / Blue-800 */

/* Pulse animation for urgent items */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Notification dot for header icon */
.notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background-color: #ef4444;
    /* Red-500 */
    border-radius: 50%;
    border: 2px solid white;
}

/* Dropdown styles for header notifications/user menu */
#notificationDropdown,
#userMenuDropdown {
    transition: all 0.2s ease-out;
    transform-origin: top right;
    opacity: 0;
    transform: scale(0.95);
    visibility: hidden;
}

#notificationDropdown.active,
#userMenuDropdown.active {
    opacity: 1;
    transform: scale(1);
    visibility: visible;
}

/* Mobile Sidebar specific styles */
/* Hidden by default on small screens, shown on medium and larger */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 256px;
    /* w-64 */
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 100;
    /* Above overlay and header, below modal */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    /* Added shadow for depth */
}

.sidebar.open {
    transform: translateX(0);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 90;
    /* Below sidebar, above header */
    opacity: 0;
    visibility: hidden;
    display: none;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
    display: block;
}

/* Adjust main content for larger screens (md and up) */
@media (min-width: 768px) {

    /* md breakpoint */
    .sidebar {
        position: relative;
        transform: translateX(0);
        width: 256px;
        /* w-64 */
        flex-shrink: 0;
        /* Prevent sidebar from shrinking */
    }

    .overlay {
        display: none;
        /* Hide overlay on larger screens */
    }
}

/* --- Mobile Human-Friendly Helpers --- */
@media (max-width: 640px) {
    .mobile-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .mobile-stack>* {
        margin-left: 0 !important;
        margin-bottom: 0.5rem;
    }

    .mobile-stack>*:last-child {
        margin-bottom: 0;
    }

    .mobile-px-2 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}