* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

h1 {
    color: #2c3e50;
    font-size: 2rem;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.month-nav button {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

.month-nav button:hover {
    background: #2980b9;
}

#currentMonth {
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 150px;
    text-align: center;
}

.actions {
    display: flex;
    gap: 10px;
}

.actions button {
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

.actions button:hover {
    background: #219a52;
}

.totals {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.total-item {
    text-align: center;
}

.total-item label {
    display: block;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.total-item span {
    font-size: 1.5rem;
    color: #27ae60;
    font-weight: bold;
}

.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #34495e;
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
}

tr:hover {
    background-color: #f8f9fa;
}

input[type="number"], input[type="text"], textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

input[type="number"]:focus, input[type="text"]:focus, textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

textarea {
    resize: vertical;
    min-height: 60px;
}

.date-cell {
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
}

.day-name {
    font-size: 0.8em;
    color: #666;
    font-weight: normal;
}

.weekend {
    background-color: #fff3cd;
}

input[type="checkbox"] {
    width: auto;
    padding: 0;
    margin: 0 auto;
    display: block;
    transform: scale(1.2);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

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

.close:hover {
    color: #000;
}

#emailForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#emailForm label {
    font-weight: bold;
}

#emailForm input[type="email"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#emailForm button {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

#emailForm button:hover {
    background: #2980b9;
}

/* Yearly Summary Styles */
.year-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.year-nav button {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

.year-nav button:hover {
    background: #2980b9;
}

.year-totals {
    margin-bottom: 30px;
}

.year-totals h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

.month-name {
    font-weight: bold;
    color: #2c3e50;
}

.number {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.total-reg {
    background-color: #e8f6f3;
    font-weight: bold;
}

.total-hours {
    background-color: #fdf2e9;
    font-weight: bold;
}

.empty-month {
    opacity: 0.5;
}

.view-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
}

.view-btn:hover {
    background: #219a52;
}

.actions button {
    margin-left: 5px;
}

#yearlyTable th:nth-child(2),
#yearlyTable th:nth-child(3),
#yearlyTable th:nth-child(4),
#yearlyTable th:nth-child(5),
#yearlyTable th:nth-child(6),
#yearlyTable th:nth-child(7) {
    min-width: 90px;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .totals {
        flex-direction: column;
        gap: 15px;
    }
    
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px 4px;
    }
    
    .year-nav {
        justify-content: center;
        margin-bottom: 15px;
    }
    
    .actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .actions button {
        margin-left: 0;
    }
}

/* Login Page Styles */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.login-card h2 {
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 1.2rem;
    font-weight: normal;
}

.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.login-btn {
    width: 100%;
    background: #3498db;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.login-btn:hover {
    background: #2980b9;
}

.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
}

.alert-error {
    background: #e74c3c;
    color: white;
}

.alert-warning {
    background: #f39c12;
    color: white;
}

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ecf0f1;
}

.login-footer p {
    color: #7f8c8d;
    font-size: 14px;
    margin: 0;
}

/* Logout Button Styling */
.logout-btn {
    background: #e74c3c !important;
}

.logout-btn:hover {
    background: #c0392b !important;
}

/* Mobile login adjustments */
@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
        margin: 10px;
    }
    
    .login-card h1 {
        font-size: 1.5rem;
    }
    
    .form-group input, .login-btn {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Loading Indicator Styles */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ecf0f1;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    color: #2c3e50;
    font-size: 16px;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ensure table container has relative positioning for overlay */
.table-container {
    position: relative;
}

/* Hide loading indicator by default */
.loading-overlay {
    display: none;
}

/* Backup & Recovery Page Styles */
.backup-section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 25px;
}

.backup-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

.status-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.status-label {
    font-weight: bold;
    color: #2c3e50;
}

.status-value {
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
}

.status-value.success {
    background: #d5f4e6;
    color: #27ae60;
}

.status-value.error {
    background: #fadbd8;
    color: #e74c3c;
}

.status-value.warning {
    background: #fdf2e9;
    color: #f39c12;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.action-btn.primary {
    background: #3498db;
    color: white;
}

.action-btn.primary:hover {
    background: #2980b9;
}

.action-btn.danger {
    background: #e74c3c;
    color: white;
}

.action-btn.danger:hover {
    background: #c0392b;
}

.action-btn:not(.primary):not(.danger) {
    background: #95a5a6;
    color: white;
}

.action-btn:not(.primary):not(.danger):hover {
    background: #7f8c8d;
}

.action-btn.small {
    padding: 6px 12px;
    font-size: 14px;
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.backups-table {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr;
    gap: 10px;
}

.backup-header {
    display: contents;
    font-weight: bold;
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
}

.backup-header > span {
    padding: 12px 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.backup-row {
    display: contents;
}

.backup-row > span {
    padding: 12px 8px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    align-items: center;
}

.backup-actions {
    gap: 8px;
}

.backup-date {
    font-family: 'Courier New', monospace;
}

.backup-size {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.message {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background: #d5f4e6;
    color: #27ae60;
    border-left: 4px solid #27ae60;
}

.message.error {
    background: #fadbd8;
    color: #e74c3c;
    border-left: 4px solid #e74c3c;
}

.message.info {
    background: #d6eaff;
    color: #3498db;
    border-left: 4px solid #3498db;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.modal-buttons button {
    flex: 1;
}

/* Mobile backup adjustments */
@media (max-width: 768px) {
    .status-panel {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
        text-align: center;
    }
    
    .backups-table {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .backup-header {
        display: none;
    }
    
    .backup-row {
        display: block;
        background: #f8f9fa;
        border-radius: 6px;
        margin-bottom: 10px;
        padding: 15px;
    }
    
    .backup-row > span {
        display: block;
        border: none;
        padding: 5px 0;
    }
    
    .backup-date:before {
        content: "Date: ";
        font-weight: bold;
    }
    
    .backup-size:before {
        content: "Size: ";
        font-weight: bold;
    }
}