:root {
    --primary-color: #4CAF50;
    --primary-dark: #45a049;
    --secondary-color: #2196F3;
    --secondary-dark: #0b7dda;
    --danger-color: #f44336;
    --danger-dark: #da190b;
    --light-gray: #f4f4f4;
    --medium-gray: #ddd;
    --dark-gray: #333;
    --text-color: #333;
    --bg-color: #ffffff;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0;
    padding: 0;
    background-color: var(--light-gray);
    color: var(--text-color);
    line-height: 1.6;
}

main {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

h1, h2, h3, h4 {
    color: var(--dark-gray);
    margin-top: 0;
    line-height: 1.2;
}

/* --- Header & Navigation --- */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 1.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    margin: 0;
    cursor: pointer;
    display: inline-block;
}

nav#main-nav button {
    background-color: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.7);
    padding: 0.6rem 1rem;
    margin: 0.5rem 0.25rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: bold;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

nav#main-nav button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}


/* --- Page & Control Styles --- */
.page {
    background-color: var(--bg-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    display: none; /* Default hidden */
}

.page.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

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

.page-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-bar {
    padding: 0.7rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-size: 1rem;
    width: 280px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.search-bar:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

/* --- General Button Styles --- */
.btn {
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}
.btn:active {
    transform: translateY(0px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}
.btn-secondary:hover {
    background-color: var(--secondary-dark);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}
.btn-danger:hover {
    background-color: var(--danger-dark);
}


/* --- Dashboard Specific Styles --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.dashboard-card {
    background-color: var(--bg-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    text-align: center;
    border-left: 5px solid var(--primary-color);
    box-shadow: var(--box-shadow);
}

.dashboard-card h3 {
    margin-top: 0;
    color: #555;
}

.dashboard-card p {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 0;
    color: var(--primary-color);
}
#teacher-name {
    font-weight: bold;
    color: var(--primary-dark);
    border-bottom: 2px dotted var(--primary-dark);
    cursor: pointer;
}

/* --- List Item Styles --- */
.list-item {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.list-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--box-shadow);
}

.list-item span {
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
}
.list-item div {
    display: flex;
    gap: 0.5rem;
}

/* --- Profile / Details Page Specifics --- */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--medium-gray);
    padding-bottom: 1rem;
}

.profile-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--medium-gray);
    flex-wrap: wrap;
}

.profile-tabs .tab-button {
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: border-color 0.2s ease, color 0.2s ease;
    margin-right: 1rem;
    color: #555;
}

.profile-tabs .tab-button.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: bold;
}

.profile-tab-content { display: none; }
.profile-tab-content.active { display: block; animation: fadeIn 0.4s; }


/* --- Form Styles --- */
form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

form input[type="text"],
form input[type="tel"],
form input[type="date"],
form select,
form textarea {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

form input:focus, form select:focus, form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}


/* --- Modal Styles --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: var(--border-radius);
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close-button:hover { color: black; }

/* --- Daily Entry Table --- */
.daily-entry-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
}
.daily-entry-table th, .daily-entry-table td {
    border: 1px solid var(--medium-gray);
    padding: 10px;
    text-align: left;
    vertical-align: middle;
}
.daily-entry-table th {
    background-color: var(--light-gray);
}
.daily-entry-table td select, .daily-entry-table td input[type="text"] {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

.payment-status {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: white;
    font-weight: bold;
    margin-left: 10px;
}

.payment-status.paid {
    background-color: var(--primary-color);
}

.payment-status.late {
    background-color: #f0ad4e; /* Sariq */
}

.payment-status.unpaid {
    background-color: var(--danger-color);
}

/* --- YANGI: Oylar bo'yicha filtr uchun stillar --- */
.filter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background-color: var(--light-gray);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.filter-controls select {
    padding: 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--medium-gray);
}
.data-management {
    margin-top: 2.5rem;
    padding: 1.5rem;
    background-color: #fff8e1; /* Light yellow warning color */
    border: 1px solid #ffecb3;
    border-left: 5px solid #fdd835;
    border-radius: var(--border-radius);
}

.data-management h3 {
    margin-top: 0;
    color: #424242;
}

.data-management p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #616161;
}

.data-management-buttons {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.data-management-buttons label.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


.app-footer {
    background-color: var(--dark-gray);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    font-size: 0.9rem;
}

.app-footer p {
    margin: 0.5rem 0;
    line-height: 1.5;
}

.app-footer a {
    color: #ffffff;
    font-weight: bold;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease, border-bottom-color 0.2s ease;
}

.app-footer a:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}
/* --- Responsive Design --- */
@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
    .page-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .search-bar {
        width: 100%;
    }
    header h1 { font-size: 1.5rem; }
    nav#main-nav button { font-size: 0.9rem; padding: 0.5rem 0.8rem; }
    
    /* Responsive Table (already well-implemented) */
    .daily-entry-table thead {
        display: none;
    }
    .daily-entry-table, .daily-entry-table tbody, .daily-entry-table tr, .daily-entry-table td {
        display: block;
        width: 100%;
    }
    .daily-entry-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--medium-gray);
        border-radius: var(--border-radius);
        padding: 0.5rem;
    }
    .daily-entry-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border: none;
        border-bottom: 1px solid #eee;
        display: flex;
        align-items: center;
        min-height: 40px;
    }
    .daily-entry-table td:last-child {
        border-bottom: none;
    }
    .daily-entry-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }
}
