/* style.css - Updated Version */
/* Basic Reset & Font */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top, not center vertically */
    min-height: 100vh;
    padding: 20px; /* Add some padding around the container */
    box-sizing: border-box;
}

.container {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    width: 100%;
    overflow: hidden;
    padding: 25px;
    box-sizing: border-box;
}

/* Header Section */
header {
    text-align: center;
    margin-bottom: 25px;
}

.month-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

#currentMonthYear {
    margin: 0;
    font-size: 2em;
    color: #2c3e50;
    font-weight: 600;
}

.nav-arrow {
    font-size: 1.5em;
    color: #3498db;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
    /* Added for better button-like behavior */
    background: none;
    border: none;
    padding: 5px;
}

.nav-arrow:hover {
    color: #2980b9;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
}

.tab-button {
    background-color: transparent;
    border: none;
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: 500;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px 8px 0 0;
    position: relative;
    top: 2px; /* To make it visually align better with border */
}

.tab-button:hover {
    color: #34495e;
    background-color: #f8f8f8;
}

.tab-button.active {
    color: #3498db;
    font-weight: 700;
    border-bottom: 3px solid #3498db;
    background-color: #ffffff;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    background-color: #ecf0f1;
    padding: 15px;
    border-radius: 8px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

.day-name {
    font-weight: 600;
    text-align: center;
    padding: 10px 0;
    color: #555;
    background-color: #e0e6e7;
    border-radius: 5px;
}

.date-cell {
    background-color: #ffffff;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    aspect-ratio: 1 / 1; /* Makes cells square */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
}

.date-cell:not(.empty):hover {
    background-color: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.date-cell.empty {
    background-color: #f7f9fb;
    cursor: default;
    border: 1px dashed #e0e0e0;
    color: #ccc;
}

/* Marked Date Style (for 'Class' marked dates, and 'Exam' marked dates in their own view) */
/* This needs to be less specific than exam-in-class-view if they ever conflict */
.date-cell.marked {
    background-color: #27ae60; /* Green for marked */
    color: #ffffff;
    font-weight: 700;
    border-color: #27ae60;
    box-shadow: 0 3px 10px rgba(46, 204, 113, 0.3);
}

.date-cell.marked:hover {
    background-color: #219653; /* Darker green on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
}

/* NEW: Style for 'Exam' dates when displayed in 'Class' view */
/* Increased specificity to ensure it overrides .marked if both were somehow present */
.date-cell.exam-in-class-view:not(.marked) { /* Added :not(.marked) for clarity, though logic prevents */
    background-color: #f39c12; /* Orange color */
    color: #ffffff;
    font-weight: 700;
    border-color: #e67e22;
    box-shadow: 0 3px 10px rgba(243, 156, 18, 0.3);
    cursor: default; /* Not editable from class view */
}

.date-cell.exam-in-class-view:not(.marked):hover { /* Apply hover only when not editable */
    background-color: #e67e22; /* Darker orange on hover */
    transform: none; /* No lift effect as it's not interactive */
    box-shadow: 0 3px 10px rgba(243, 156, 18, 0.3); /* No new shadow on hover */
}


/* Live Counter */
.live-counter {
    text-align: center;
    margin-top: 5px;
    padding: 15px;
    background-color: #e7f4f9;
    border-radius: 10px;
    border: 1px solid #d4edf7;
    font-size: 1.2em;
    color: #34495e;
    display: flex; /* Make it a flex container */
    justify-content: space-around; /* Space out the two paragraphs */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 10px; /* Gap between paragraphs */
}

.live-counter h3 {
    width: 100%;
    margin: 0 0 10px 0;
    font-size: 1.1em;
    color: #2c3e50;
    font-weight: 600;
}

.live-counter p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px; /* Gap between text and number */
}

/* Overall Counter */
.overall-counter {
    margin-top: 20px;
    padding: 15px;
    background-color: #b0ffac3d;
    border-radius: 10px;
    border: 1px solid #f0e6d2;
    font-size: 1.2em;
    color: #34495e;
    display: flex; /* Make it a flex container */
    justify-content: space-around; /* Space out the two paragraphs */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 10px; /* Gap between paragraphs */
}

.overall-counter h3 {
    width: 100%;
    margin: 0 0 10px 0;
    font-size: 1.1em;
    color: #2c3e50;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid;
    padding: 10px;
}

.overall-counter p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px; /* Gap between text and number */
}

.count-number { /* Combined style for both class and exam counts */
    font-weight: 700;
    color: #3498db;
    font-size: 1.2em; /* Slightly smaller than previous combined counter */
}

/* PIN Input Modal */
.pin-modal {
    /* Changed display:none to hidden attribute in HTML,
       and using opacity/visibility for smooth transition */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0; /* Start invisible */
    visibility: hidden; /* Prevent interaction when invisible */
    transition: opacity 0.3s ease, visibility 0.3s ease; /* Smooth transition */
}

/* When not hidden, make it visible and opaque */
.pin-modal:not([hidden]) {
    opacity: 1;
    visibility: visible;
}

.pin-modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    width: 90%;
    max-width: 400px;
    text-align: center;
    /* Slide in effect */
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

/* Apply slide effect when modal becomes visible */
.pin-modal:not([hidden]) .pin-modal-content {
    transform: translateY(0);
}


.pin-modal-content h3 {
    margin-top: 0;
    color: #34495e;
    font-size: 1.5em;
    margin-bottom: 20px;
}

.pin-modal-content input[type="password"] {
    width: calc(100% - 40px); /* Adjust for padding */
    padding: 12px 15px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1.1em;
    text-align: center;
    letter-spacing: 2px;
}

.pin-modal-content button {
    background-color: #3498db;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin: 0 5px;
    transition: background-color 0.2s ease-in-out;
}

.pin-modal-content button:hover {
    background-color: #2980b9;
}

.pin-modal-content .cancel-button {
    background-color: #e74c3c;
}

.pin-modal-content .cancel-button:hover {
    background-color: #c0392b;
}

#pinError {
    color: #e74c3c;
    margin-top: 10px;
    display: none;
}

/* Focus states for accessibility */
.nav-arrow:focus,
.tab-button:focus,
.date-cell:focus,
#pinInput:focus,
#pinConfirmBtn:focus,
#pinCancelBtn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        border-radius: 8px;
    }

    #currentMonthYear {
        font-size: 1.6em;
    }

    .nav-arrow {
        font-size: 1.2em;
    }

    .tab-button {
        padding: 10px 15px;
        font-size: 1em;
    }

    .calendar-grid {
        gap: 5px;
        padding: 10px;
    }

    .day-name {
        font-size: 0.9em;
        padding: 8px 0;
    }

    .date-cell {
        font-size: 1em;
        border-radius: 5px;
    }

    .live-counter {
        font-size: 1em;
        padding: 12px;
        gap: 5px;
    }
    
    .overall-counter {
        font-size: 1em;
        padding: 12px;
        gap: 5px;
    }
    
    .count-number {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 10px;
    }

    #currentMonthYear {
        font-size: 1.4em;
    }

    .month-navigation {
        gap: 10px;
    }

    .nav-arrow {
        font-size: 1em;
    }

    .tab-button {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    .calendar-grid {
        gap: 3px;
        padding: 8px;
    }

    .day-name {
        font-size: 0.8em;
        padding: 6px 0;
    }

    .date-cell {
        font-size: 0.9em;
        border-radius: 4px;
    }

    .live-counter {
        font-size: 0.9em;
        padding: 10px;
        flex-direction: column; /* Stack counts vertically */
    }
    
    .overall-counter {
        font-size: 0.9em;
        padding: 10px;
        flex-direction: column; /* Stack counts vertically */
    }
    
    .count-number {
        font-size: 1em;
    }

    .pin-modal-content {
        padding: 20px;
        width: 95%;
    }

    .pin-modal-content h3 {
        font-size: 1.3em;
    }

    .pin-modal-content input[type="password"] {
        padding: 10px 12px;
        font-size: 1em;
    }

    .pin-modal-content button {
        padding: 10px 20px;
        font-size: 0.9em;
    }
}

/* Header Icon Styling */
.title-with-icon {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.header-icon:hover {
    transform: scale(1.05);
}

/* Responsive adjustments for header icon */
@media (max-width: 768px) {
    .header-icon {
        width: 28px;
        height: 28px;
    }
    
    .title-with-icon {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .header-icon {
        width: 24px;
        height: 24px;
    }
    
    .title-with-icon {
        gap: 6px;
    }
}

/* Add these styles to your existing style.css */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  padding: 8px;
  background-color: #f8f9fa;
  border-radius: 6px;
}

.additional-stats {
  width: 100%;
  margin-top: 15px;
}

.stat-highlight {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  background-color: #e9f7ef;
  border-radius: 6px;
  margin-bottom: 8px;
}

.highlight-label {
  font-weight: 600;
}

.highlight-value {
  font-weight: 500;
  color: #27ae60;
}