* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --border: #e5e5e5;
    --text-primary: #171717;
    --text-secondary: #737373;
    --text-tertiary: #a3a3a3;
    --accent: #3b82f6;
    --accent-light: #eff6ff;
    --fem: #ec4899;
    --fem-light: #fdf2f8;
    --masc: #3b82f6;
    --masc-light: #eff6ff;
    --success: #10b981;
    --warning: #f59e0b;
    --radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    margin-bottom: 0;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.logo {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-user {
    font-size: 12px;
    color: var(--text-secondary);
    margin-right: 8px;
}

.header-user strong {
    color: var(--text-primary);
}

/* Stats Bar */
.stats-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Toolbar */
.toolbar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.search-input:focus {
    border-color: var(--accent);
}

.toolbar-search {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 600px;
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

/* Buttons */
.btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    color: var(--text-primary);
    font-family: inherit;
}

.btn:hover {
    background: var(--bg);
    border-color: var(--text-secondary);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-danger {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.filter-group {
    display: flex;
    gap: 4px;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius);
}

.filter-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s;
    font-family: inherit;
}

.filter-btn.active {
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Gender Sections */
.gender-section {
    margin-bottom: 32px;
}

.gender-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gender-header.fem { color: var(--fem); }
.gender-header.masc { color: var(--masc); }

/* Room Type Sections */
.room-type {
    margin-bottom: 24px;
}

.room-type-header {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.type-badge {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Rooms Grid */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.room {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    transition: all 0.2s;
}

.room.full {
    border-color: var(--success);
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 8px;
}

.room-number {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.room-capacity {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.room-capacity.full {
    background: #d1fae5;
    color: var(--success);
}

.room-slots {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 40px;
}

.empty-slot {
    border: 1px dashed var(--border);
    border-radius: 4px;
    padding: 8px;
    text-align: center;
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Person Card */
.person {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.person:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.person.fem {
    border-left: 3px solid var(--fem);
}

.person.masc {
    border-left: 3px solid var(--masc);
}

.person-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.person.fem .person-avatar {
    background: var(--fem-light);
    color: var(--fem);
}

.person.masc .person-avatar {
    background: var(--masc-light);
    color: var(--masc);
}

.person-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.detail-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 120px;
}

.detail-value {
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--text-primary);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: #ef4444; }
.toast.warning { background: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Loading */
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.loading.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Tabs */
.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Import Modal */
.import-summary {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 12px;
}

.import-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.import-summary .summary-row .label {
    color: var(--text-secondary);
}

.import-summary .summary-row .value {
    font-weight: 600;
}

/* Utilities */
.hidden { display: none !important; }

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .rooms-grid {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .logo {
        font-size: 14px;
    }

    .toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .toolbar-search {
        max-width: unset;
        width: 100%;
    }

    .search-input {
        width: 100%;
        min-width: unset;
    }

    .filter-group {
        width: 100%;
        justify-content: center;
    }

    #btnExport {
        width: 100%;
    }

    .room {
        padding: 10px;
    }

    .room-slots {
        gap: 8px;
    }

    .person {
        width: 100%;
        justify-content: flex-start;
    }

    .person-name {
        white-space: normal;
        word-break: break-word;
    }

    .tab-btn {
        padding: 10px 12px;
        font-size: 13px;
    }

    .gender-header {
        font-size: 12px;
        flex-wrap: wrap;
    }

    .modal-content {
        max-height: 90vh;
        margin: 10px;
    }

    .detail-row {
        flex-direction: column;
        gap: 4px;
    }

    .detail-label {
        min-width: unset;
    }
}

@media (max-width: 400px) {
    .header-actions .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .header-user {
        display: none;
    }

    .tab-btn {
        padding: 8px 10px;
        font-size: 12px;
    }
}
