* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.hidden {
    display: none !important;
}

/* Login Page */
#loginPage {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: white;
}

.form-group label input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
    cursor: pointer;
}

.form-group label {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.close-status {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close-status:hover {
    color: #000;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-large {
    padding: 15px 30px;
    font-size: 18px;
}

.btn-danger {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-edit {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    margin-right: 5px;
}

.btn-edit:hover {
    background: #218838;
}

.message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 5px;
    text-align: center;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.login-note {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.login-note a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.login-note a:hover {
    text-decoration: underline;
}

/* Dashboard */
.navbar {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h2 {
    color: #667eea;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

#usernameDisplay {
    font-weight: 600;
    color: #555;
}

.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.card h3 {
    margin-bottom: 20px;
    color: #667eea;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.checkin-status {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
    font-weight: 600;
}

.checkin-status.checked {
    background: #d4edda;
    color: #155724;
}

.checkin-status.not-checked {
    background: #fff3cd;
    color: #856404;
}

#checkinBtn {
    width: 100%;
    margin-bottom: 20px;
}

/* Calendar Styles */
.calendar-container {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.calendar-header h4 {
    margin: 0;
    color: #667eea;
    font-size: 18px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 15px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    color: #667eea;
    padding: 10px 5px;
    font-size: 14px;
    background: #f8f9fa;
    border-radius: 5px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    background: white;
    position: relative;
}

.calendar-day:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calendar-day.checked {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.calendar-day.checked:hover {
    background: #c3e6cb;
}

/* Status classes - must come after .checked to override */
.calendar-day.checked.status-ปกติ {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.calendar-day.checked.status-ลา {
    background: #fff3cd !important;
    border-color: #ffc107 !important;
    color: #856404 !important;
}

.calendar-day.checked.status-มาสาย {
    background: #f8d7da !important;
    border-color: #dc3545 !important;
    color: #721c24 !important;
}

.calendar-day.checked.status-ขาดงาน {
    background: #d1ecf1 !important;
    border-color: #17a2b8 !important;
    color: #0c5460 !important;
}

.calendar-day.checked.status-อื่นๆ {
    background: #e2e3e5 !important;
    border-color: #6c757d !important;
    color: #383d41 !important;
}

.calendar-day.checked.status-ลา:hover {
    background: #ffe69c !important;
}

.calendar-day.checked.status-มาสาย:hover {
    background: #f5c6cb !important;
}

.calendar-day.checked.status-ขาดงาน:hover {
    background: #bee5eb !important;
}

.calendar-day.checked.status-อื่นๆ:hover {
    background: #d6d8db !important;
}

.calendar-day.not-paid {
    opacity: 0.7;
    position: relative;
}

.calendar-day.not-paid::after {
    content: '✗';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 12px;
    color: #dc3545;
    font-weight: bold;
}

.calendar-day.today {
    border-color: #667eea;
    background: #e7f0ff;
    font-weight: bold;
}

.calendar-day.today.checked {
    background: #b8d4c1;
    border-color: #28a745;
}

.calendar-day.future {
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.calendar-day.future:hover {
    transform: none;
    box-shadow: none;
}

.calendar-day.other-month {
    opacity: 0.3;
    background: #f8f9fa;
}

.calendar-day.empty {
    border: none;
    cursor: default;
    background: transparent;
}

.calendar-day.empty:hover {
    transform: none;
    box-shadow: none;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.legend-box {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 2px solid #e0e0e0;
}

.legend-box.checked {
    background: #d4edda;
    border-color: #28a745;
}

.legend-box.status-ลา {
    background: #fff3cd;
    border-color: #ffc107;
}

.legend-box.status-มาสาย {
    background: #f8d7da;
    border-color: #dc3545;
}

.legend-box.status-ขาดงาน {
    background: #d1ecf1;
    border-color: #17a2b8;
}

.legend-box.status-อื่นๆ {
    background: #e2e3e5;
    border-color: #6c757d;
}

.legend-box.today {
    border-color: #667eea;
    background: #e7f0ff;
}

.month-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

#currentMonthDisplay {
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-card h4 {
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-card .value {
    font-size: 28px;
    font-weight: bold;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.summary-table th,
.summary-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.summary-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.summary-table tr:hover {
    background: #f8f9fa;
}

.money-type-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #667eea;
}

.money-type-info {
    flex: 1;
}

.money-type-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.money-type-amount {
    color: #28a745;
    font-size: 18px;
}

.money-type-actions {
    display: flex;
    gap: 10px;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

#modalTitle {
    margin-bottom: 20px;
    color: #667eea;
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .card {
        padding: 20px;
    }
    
    .navbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .month-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .calendar-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .calendar-header h4 {
        order: -1;
    }
    
    .calendar-day {
        font-size: 14px;
        padding: 5px;
    }
    
    .calendar-legend {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
}

