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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 0;
}

.page-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    min-height: 70px;
}

.page-logo {
    position: absolute;
    left: 0;
    height: 70px;
    width: auto;
}

.page-title-group {
    text-align: center;
}

h1.page-title {
    font-size: 28px;
    color: #2c3e50;
    margin: 0;
}

.title-en {
    font-weight: 400;
    color: #3498db;
}

.page-subtitle {
    font-size: 14px;
    color: #7f8c8d;
    margin-top: 5px;
}

.header-link {
    position: absolute;
    right: 0;
    font-size: 14px;
    color: #3498db;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid #3498db;
    border-radius: 20px;
    transition: all 0.2s;
}

.header-link:hover {
    background: #3498db;
    color: white;
}

.step-title {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.step-title span {
    background: white;
    color: #2c3e50;
    padding: 2px 10px;
    border-radius: 12px;
    margin-right: 10px;
    font-size: 14px;
}

.input-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.input-section.two-column {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
    .input-section.two-column {
        grid-template-columns: 1fr;
    }
}

.input-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.input-card h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.input-card textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    resize: vertical;
}

.input-card textarea:focus {
    outline: none;
    border-color: #3498db;
}

.input-card small {
    display: block;
    color: #888;
    margin-top: 8px;
}

.input-card.full-width {
    grid-column: 1 / -1;
}

.input-card.full-width textarea {
    min-height: 150px;
    font-family: monospace;
    font-size: 12px;
}

.btn-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-calculate {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.btn-calculate:hover {
    box-shadow: 0 5px 20px rgba(39, 174, 96, 0.4);
}

.btn-generate {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-generate:hover {
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.4);
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-title h2 {
    color: #2c3e50;
    margin: 0;
    font-size: 20px;
}

.section-title .count-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.section-title .count {
    background: #27ae60;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
}

.section-title .count-o {
    background: #e8f5e9;
    color: #27ae60;
}

.section-title .count-i {
    background: #fff3e0;
    color: #f39c12;
}

.room-table-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow-x: auto;
    display: none;
}

.room-table-container.show {
    display: block;
}

.room-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.room-table th, .room-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.room-table th {
    background: #34495e;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.room-table tr:hover {
    background: #f8f9fa;
}

.room-table .badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-o {
    background: #e8f5e9;
    color: #27ae60;
}

.badge-i {
    background: #fff3e0;
    color: #f39c12;
}

.badge-time {
    background: #e3f2fd;
    color: #1976d2;
}

.staff-section {
    display: none;
    margin-bottom: 30px;
}

.staff-section.show {
    display: block;
}

.result-section {
    display: none;
}

.result-section.show {
    display: block;
}

.result-header {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.result-header h2 {
    color: #27ae60;
    margin-bottom: 10px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

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

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #3498db;
}

.stat-label {
    color: #666;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.staff-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.staff-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 15px 20px;
}

.staff-name {
    font-size: 20px;
    font-weight: bold;
}

.staff-info {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 5px;
}

.room-list {
    padding: 15px 20px;
    max-height: 300px;
    overflow-y: auto;
}

.room-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ecf0f1;
    padding: 8px 12px;
    margin: 4px;
    border-radius: 20px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 13px;
}

.room-item .badge {
    padding: 2px 6px;
    font-size: 10px;
    margin-left: 2px;
}

.room-count {
    background: #3498db;
    color: white;
    padding: 10px 20px;
    text-align: center;
    font-weight: bold;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading.show {
    display: block;
}

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

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

.error {
    background: #e74c3c;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.error.show {
    display: block;
}

.staff-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.staff-checkbox-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.staff-checkbox-item:hover {
    border-color: #3498db;
    background: #eef6fc;
}

.staff-checkbox-item.checked {
    border-color: #27ae60;
    background: #e8f5e9;
}

.staff-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
}

.staff-checkbox-item .staff-label {
    flex: 1;
    font-weight: 500;
    color: #2c3e50;
}

.staff-checkbox-item .floor-badge {
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.staff-checkbox-item .floor-badge.no-floor {
    background: #95a5a6;
}

.staff-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-small {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-select-all {
    background: #3498db;
    color: white;
}

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

.btn-deselect-all {
    background: #95a5a6;
    color: white;
}

.btn-deselect-all:hover {
    background: #7f8c8d;
}

.btn-download {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.btn-download:hover {
    background: linear-gradient(135deg, #219a52, #27ae60);
}

.btn-download-schedule {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    margin-left: 20px;
    transition: all 0.2s;
}

.btn-download-schedule:hover {
    background: linear-gradient(135deg, #219a52, #27ae60);
    transform: translateY(-2px);
}

.unassigned-section {
    background: #fff5f5;
    border: 2px solid #e74c3c;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.unassigned-title {
    color: #e74c3c;
    margin-bottom: 15px;
    font-size: 18px;
}

.unassigned-count {
    background: #e74c3c;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 14px;
    margin-left: 5px;
}

.unassigned-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.room-item.unassigned {
    background: #ffebee;
    border: 1px solid #e74c3c;
    color: #c0392b;
}

/* Step 0: 인력 설정 스타일 */
.staff-config-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.staff-config-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
}

.staff-config-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.staff-config-name {
    flex: 1;
    font-weight: 500;
    color: #2c3e50;
}

.staff-config-floor {
    background: #3498db;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

.staff-add-form {
    display: flex;
    gap: 10px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.staff-input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.staff-input:focus {
    outline: none;
    border-color: #3498db;
}

.staff-input[type="text"] {
    flex: 1;
    min-width: 100px;
}

.staff-input[type="number"] {
    width: 150px;
}

.btn-add-staff {
    background: #27ae60;
    color: white;
    padding: 10px 20px;
}

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

.btn-edit-staff {
    background: #f39c12;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-edit-staff:hover {
    background: #e67e22;
}

.btn-delete-staff {
    background: #e74c3c;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-delete-staff:hover {
    background: #c0392b;
}

.btn-reset-staff {
    background: #95a5a6;
    color: white;
    padding: 10px 20px;
    margin-left: auto;
}

.btn-reset-staff:hover {
    background: #7f8c8d;
}

/* 파일 업로드 스타일 */
.file-upload-container {
    position: relative;
    margin-bottom: 10px;
}

.file-upload-container input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    border: 2px dashed #bdc3c7;
    border-radius: 10px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
}

.file-upload-label:hover {
    border-color: #3498db;
    background: #eef6fc;
}

.file-upload-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.file-upload-text {
    font-size: 14px;
    color: #7f8c8d;
}

.file-name {
    text-align: center;
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
    margin-top: 8px;
}

.file-name:empty {
    display: none;
}

.upload-status {
    text-align: center;
    font-size: 14px;
    padding: 8px;
    border-radius: 5px;
    margin-top: 8px;
}

.upload-status:empty {
    display: none;
}

.upload-status.success {
    background: #e8f5e9;
    color: #27ae60;
}

.upload-status.error {
    background: #ffebee;
    color: #e74c3c;
}

.file-upload-container.dragover .file-upload-label {
    border-color: #27ae60;
    background: #e8f5e9;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.card-header-row h3 {
    margin: 0;
    padding: 0;
    border: none;
}

.btn-sample {
    background: #9b59b6;
    color: white;
}

.btn-sample:hover {
    background: #8e44ad;
}

/* ===== 반응형 스타일 ===== */

/* 태블릿 (768px 이하) */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .page-header {
        flex-direction: column;
        gap: 15px;
    }

    .page-logo {
        position: static;
        height: 70px;
    }

    .header-link {
        position: static;
        font-size: 13px;
        padding: 6px 14px;
    }

    h1.page-title {
        font-size: 22px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    .step-title {
        font-size: 16px;
        padding: 10px 15px;
    }

    .step-title span {
        font-size: 12px;
        padding: 2px 8px;
    }

    .section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .section-title .count-group {
        flex-wrap: wrap;
        width: 100%;
    }

    .section-title .count {
        font-size: 12px;
        padding: 4px 10px;
    }

    .staff-add-form {
        flex-wrap: wrap;
    }

    .staff-input[type="number"] {
        width: 100%;
    }

    .btn-add-staff,
    .btn-reset-staff {
        flex: 1;
        text-align: center;
    }

    .staff-config-list {
        grid-template-columns: 1fr;
    }

    .staff-checkbox-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .staff-actions {
        justify-content: center;
    }

    .btn {
        padding: 12px 20px;
        font-size: 14px;
        width: 100%;
    }

    .btn-container {
        flex-direction: column;
    }

    .result-header h2 {
        font-size: 18px;
    }

    .btn-download-schedule {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }

    .stats {
        gap: 15px;
    }

    .stat-value {
        font-size: 24px;
    }

    .schedule-grid {
        grid-template-columns: 1fr;
    }

    .room-table th,
    .room-table td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .card-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .card-header-row .btn-sample {
        width: 100%;
        text-align: center;
    }

    .file-upload-label {
        padding: 20px 15px;
    }

    .file-upload-icon {
        font-size: 30px;
    }

    .file-upload-text {
        font-size: 13px;
    }
}

/* 모바일 (480px 이하) */
@media (max-width: 480px) {
    .page-logo {
        height: 60px;
    }

    h1.page-title {
        font-size: 20px;
    }

    .page-subtitle {
        font-size: 12px;
    }

    .input-card {
        padding: 15px;
    }

    .input-card h3 {
        font-size: 14px;
    }

    .input-card small {
        font-size: 11px;
    }

    .staff-config-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .staff-config-item .btn-small {
        padding: 4px 8px;
        font-size: 11px;
    }

    .staff-checkbox-grid {
        grid-template-columns: 1fr;
    }

    .staff-checkbox-item {
        padding: 10px 12px;
    }

    .staff-checkbox-item .staff-label {
        font-size: 14px;
    }

    .room-item {
        padding: 6px 10px;
        font-size: 12px;
    }

    .unassigned-section {
        padding: 15px;
    }

    .unassigned-title {
        font-size: 16px;
    }

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