/* --- General & Typography --- */
@charset "UTF-8";

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f7f9;
    color: #444;
    margin: 0;
    padding: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.main-wrapper {
    max-width: 1200px;
    margin: 20px auto;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.app-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo img {
    height: 40px;
}

.header-logo span {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

/* ------------------------------------------------ */
/* --- NEW: User Display (Hello, Name) Styles --- */
/* ------------------------------------------------ */
.user-display {
    font-size: 1em;
    color: #555;
    margin-left: auto;
    padding-right: 15px;
    white-space: nowrap;
}

.user-display strong {
    font-weight: 600;
    color: #2c3e50;
}

/* ------------------------------------------------ */


.container {
    padding: 20px;
}

h1,
h2 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 20px;
}

/* --- Buttons & Links --- */
.button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #3498db;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 20px;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

.button:hover {
    background-color: #2980b9;
    text-decoration: none;
}

.button-secondary {
    background-color: #868e96;
}

.button-secondary:hover {
    background-color: #6c757d;
}

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Form Specific Styles --- */
.form-container .form-group {
    margin-bottom: 1rem;
}

.form-container label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-container input[type="text"],
.form-container input[type="email"],
.form-container input[type="password"],
.form-container input[type="number"],
.form-container input[type="tel"],
.form-container input[type="date"],
.form-container select,
.form-container textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
}

.form-container .checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-container .form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ------------------------------------------------ */
/* --- UPDATED: Alerts & Messages (For UI fix) --- */
/* ------------------------------------------------ */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    margin-top: 15px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 1.1em;
    font-weight: 500;
}

/* Styles for Success Messages (Green Box) */
.alert-success,
.alert.success {
    color: #155724;
    /* Dark green text */
    background-color: #d4edda;
    /* Light green background */
    border-color: #c3e6cb;
    /* Green border */
    font-weight: 600;
}

/* Styles for Error/Danger Messages (Red Box) */
/* The view uses 'error-message', so we include that here for the styles to apply */
.alert-danger,
.error-message {
    color: #a94442;
    /* Dark red text */
    background-color: #f2dede;
    /* Light red background */
    border-color: #ebccd1;
    /* Muted red border */
    font-weight: 600;
}

/* NEW: Style to highlight the problematic input field */
.form-group.has-error input {
    border-color: #a94442;
    box-shadow: 0 0 0 0.2rem rgba(255, 0, 0, 0.25);
}

/* This old error-message styling is now superseded by the .alert-danger styles above */
/* .error-message {
    color: #721c24;
    font-size: 0.875em;
    margin-top: 0.25rem;
} */

/* ------------------------------------------------ */


/* --- Dashboard Table Styles --- */
.dashboard-table-wrapper {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.dashboard-table th,
.dashboard-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
}

.dashboard-table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
}

/* --- Dashboard Menu Styles --- */
.dashboard-menu-container {
    margin-bottom: 0;
}

.menu-toggle-button {
    background-color: #ffffff;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    box-sizing: border-box;
    padding: 0;
}

.menu-icon {
    width: 28px;
    height: auto;
    display: block;
}

.menu-items-wrapper {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-top: 0;
}

/* --- Side Menu for Mobile --- */
.sidenav {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 10;
    top: 0;
    left: 0;
    background-color: #ffffff;
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 60px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidenav a {
    padding: 15px 32px;
    text-decoration: none;
    font-size: 1.1rem;
    display: block;
    transition: 0.3s;
    border-bottom: 1px solid #ddd;
    color: #444;
    margin: 0;
    border-left: 5px solid transparent;
}

.sidenav a.closebtn {
    position: absolute;
    top: 0;
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
    border-bottom: none;
    color: #818181;
}

.sidenav a:hover {
    color: #3498db;
    background-color: #f4f4f4;
}

.sidenav a.button {
    background-color: #ffffff;
    color: #444;
    border-radius: 0;
}

.sidenav a.button-secondary {
    background-color: #f0f0f0;
    border-left-color: #6c757d;
}

.sidenav a.button.home-bar {
    border-left-color: #FF69B4;
}

.sidenav a.button.red-bar {
    border-left-color: #e74c3c;
}

.sidenav a.button.orange-bar {
    border-left-color: #e67e22;
}

.sidenav a.button.yellow-bar {
    border-left-color: #f1c40f;
}

.sidenav a.button.green-bar {
    border-left-color: #2ecc71;
}

.sidenav a.button.blue-bar {
    border-left-color: #3498db;
}

.sidenav a.button.indigo-bar {
    border-left-color: #34495e;
}

.sidenav a.button.violet-bar {
    border-left-color: #9b59b6;
}

.action-link {
    font-weight: 500;
    white-space: nowrap;
    color: #3498db;
    text-decoration: none;
    display: inline-block;
}

/* --- Status Badge Styles --- */
.status-badge {
    padding: 5px 12px;
    border-radius: 15px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge.active {
    background-color: #28a745;
}

.status-badge.inactive {
    background-color: #6c757d;
}

/* NEW: Attendance Status Badges */
.status-badge.present {
    background-color: #2ecc71;
}

.status-badge.absent {
    background-color: #e74c3c;
}

/* --- Profile Page Specific Styles --- */
.profile-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.summary-item strong {
    color: #6c757d;
    font-weight: 500;
    font-size: 0.9em;
}

.credit-balance {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    padding: 5px 12px;
    border-radius: 9999px;
    background-color: #e9ecef;
    align-self: flex-start;
}

.credit-balance.negative {
    color: #fff;
    background-color: #e74c3c;
}

/* NEW: Credit Debit Pill for negative values */
.credit-debit {
    display: inline-block;
    padding: 4px 12px;
    background-color: #ef4444;
    color: white;
    font-weight: bold;
    border-radius: 9999px;
    text-align: center;
}

/* --- List Group for Attendance History --- */
.list-group {
    margin-top: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.list-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background-color: #f8f9fa;
    text-decoration: none;
}

.list-group-item .arrow {
    font-size: 1.5rem;
    color: #3498db;
}

/* --- Attendance Page specific styles --- */
.attendance-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.attendance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.swimmer-label {
    display: flex;
    flex-direction: column;
    font-weight: 500;
}

.swimmer-credits {
    font-size: 0.9em;
    color: #555;
    margin-top: 4px;
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: #2ecc71;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}


/* --- Responsive Styles for Mobile (< 768px) --- */
@media screen and (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .dashboard-container .dashboard-table {
        font-size: 0.9rem;
    }

    .dashboard-container .dashboard-table th,
    .dashboard-container .dashboard-table td {
        padding: 10px 8px;
    }

    .dashboard-container .mobile-hide {
        display: none;
    }

    .dashboard-container .action-link::before {
        content: '✐';
        font-size: 1.2rem;
        vertical-align: middle;
    }

    .dashboard-container .action-link span {
        display: none;
    }

    .profile-container .dashboard-table thead {
        display: table-header-group;
    }
}

/* This targets the <h1> tag containing your logo and text */
.form-container h1 {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* This styles the logo image itself */
.form-container h1 img {
    height: 70px;
    width: auto;
    margin-bottom: 0.5rem;
}

.dashboard-table td.action-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

/* --- Modern Attendance Toggle Cards --- */
.attendance-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

/* Hidden checkbox logic */
.attendance-input {
    display: none;
}

.attendance-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background-color: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    user-select: none;
}

.attendance-card:hover {
    border-color: #3498db;
    background-color: #f8fbff;
}

/* State: Swimmer is selected (Present) */
.attendance-input:checked+.attendance-card {
    border-color: #2ecc71;
    /* Green from your status-badge.present */
    background-color: #f0fff4;
    box-shadow: 0 4px 10px rgba(46, 204, 113, 0.15);
}

.swimmer-detail {
    display: flex;
    flex-direction: column;
}

.swimmer-name-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
}

.swimmer-balance-label {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 3px;
}

/* Custom Checkmark Indicator */
.check-indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.check-indicator::after {
    content: '✓';
    color: white;
    display: none;
    font-weight: bold;
}

.attendance-input:checked+.attendance-card .check-indicator {
    background-color: #2ecc71;
    border-color: #2ecc71;
}

.attendance-input:checked+.attendance-card .check-indicator::after {
    display: block;
}

/* Fix for the stretched balance pill */
.balance-pill {
    display: inline-block; /* Prevents stretching */
    padding: 4px 16px;
    border-radius: 50px;
    font-weight: bold;
    width: fit-content;    /* Shrinks the pill to fit the text */
    margin-top: 5px;
}

/* New Grid Layout for Profile Summary */
.profile-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Places items side-by-side */
    gap: 20px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Ensures children don't stretch to full width */
}
.balance-positive { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.balance-negative { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.balance-zero { background-color: #f8f9fa; color: #6c757d; border-color: #dee2e6; }