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

:root {
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --accent-color: #FF5722;
    --text-primary: #212121;
    --text-secondary: #757575;
    --divider: #BDBDBD;
    --background: #FAFAFA;
    --card-bg: #FFFFFF;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 80px;
}

/* Header */
header {
    background: var(--primary-color);
    color: white;
    padding: 24px 16px;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 24px;
    max-width: 600px;
    margin: 0 auto;
}

.header-logo {
    height: 80px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
}

.header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

header h1 {
    font-size: 28px;
    margin: 0;
    text-align: left;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
    text-align: left;
}

/* Tabs */
.tabs {
    display: flex;
    background: white;
    border-bottom: 2px solid var(--divider);
    position: sticky;
    top: 0;
    z-index: 10;
}

.tab-btn {
    flex: 1;
    padding: 16px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.date-header {
    padding: 16px;
    background: white;
    margin: 16px 16px 0 16px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.date-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

/* Schedule List */
.schedule-list {
    padding: 16px;
}

.schedule-item {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease-out;
    position: relative;
}

.schedule-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.schedule-item .delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 18px;
    transition: all 0.2s;
    opacity: 0;
}

.schedule-item:hover .delete-btn {
    opacity: 1;
}

.schedule-item .delete-btn:hover {
    background: #ffebee;
    color: #d32f2f;
}

.schedule-item .name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.schedule-item .time {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.schedule-item .time svg {
    width: 16px;
    height: 16px;
}

.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    opacity: 0.5;
    margin-bottom: 16px;
}

/* Week View */
.day-section {
    margin: 16px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.day-header {
    background: var(--primary-color);
    color: white;
    padding: 12px 16px;
    font-weight: 600;
}

.day-header.today {
    background: var(--accent-color);
}

.day-items {
    padding: 8px;
}

.day-items .schedule-item {
    margin: 8px;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 100;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 20px rgba(0,0,0,0.2);
}

.fab:active {
    transform: scale(0.95);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--divider);
}

.modal-header h3 {
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-btn:hover {
    background: var(--background);
}

/* Form */
#attendance-form {
    padding: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--divider);
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
    background-color: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23757575' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

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

.submit-btn:active {
    transform: scale(0.98);
}

/* Mobile Optimization */
@media (max-width: 600px) {
    header {
        padding: 20px 16px;
    }
    
    .header-content {
        gap: 16px;
    }
    
    header h1 {
        font-size: 22px;
    }
    
    .header-logo {
        height: 60px;
    }
    
    .fab {
        bottom: 16px;
        right: 16px;
    }
    
    .modal-content {
        margin: 0;
        border-radius: 8px 8px 0 0;
        align-self: flex-end;
    }
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--divider);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* Recurring Section */
.recurring-section {
    border-top: 1px solid var(--divider);
    padding-top: 16px;
    margin-top: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label span {
    font-weight: 500;
    color: var(--text-primary);
}

/* Recurring indicator badge */
.recurring-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    background: #E3F2FD;
    color: #1976D2;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.recurring-badge svg {
    width: 12px;
    height: 12px;
}

/* Registry View */
.registry-filters {
    background: white;
    padding: 20px;
    margin: 16px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.filter-type {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.radio-label input[type="radio"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.radio-label span {
    font-weight: 500;
    color: var(--text-primary);
}

.date-filter {
    margin-bottom: 16px;
}

.date-filter label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.date-filter input[type="date"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--divider);
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.date-filter input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.load-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

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

.registry-results {
    margin: 16px;
}

.registry-header {
    background: white;
    padding: 16px;
    border-radius: 8px 8px 0 0;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.registry-header h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin: 0;
}

.count-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.registry-list {
    background: white;
    padding: 8px;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow);
}

.registry-item {
    background: var(--background);
    border-radius: 6px;
    padding: 12px;
    margin: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.registry-item .name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.registry-item .time {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 14px;
}

.registry-item .time svg {
    width: 14px;
    height: 14px;
}

.registry-week-list {
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow);
}

.registry-day-section {
    border-bottom: 1px solid var(--divider);
}

.registry-day-section:last-child {
    border-bottom: none;
}

.registry-day-header {
    background: var(--background);
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.registry-day-header.closed {
    color: var(--text-secondary);
}

.registry-day-items {
    padding: 4px;
}

