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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    overflow-x: hidden;
    box-sizing: border-box;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 20px;
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
}

h1 {
    color: #667eea;
    margin-bottom: 6px;
    font-size: 1.6em;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 6px;
    font-size: 0.95em;
}

.timezone-info {
    text-align: center;
    color: #333;
    margin-bottom: 15px;
    font-size: 0.8em;
    font-style: italic;
    padding: 8px 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    font-weight: 500;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

.form-group h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.2em;
    font-weight: 600;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
    background-color: white;
    font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.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='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 0.9em;
}

.time-slots {
    margin: 20px 0;
}

.time-slots h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.usage-hint {
    margin-bottom: 15px;
    color: #666;
    font-size: 0.85em;
    font-style: italic;
    padding: 8px 12px;
    background: #f0f7ff;
    border-left: 3px solid #667eea;
    border-radius: 4px;
}

.schedule-grid {
    display: grid;
    grid-template-columns: 130px repeat(7, minmax(50px, 1fr));
    gap: 4px;
    margin-bottom: 15px;
    width: 100%;
    max-width: 100%;
}

.day-header,
.time-header {
    padding: 6px 4px;
    background: #667eea;
    color: white;
    text-align: center;
    font-weight: 600;
    border-radius: 4px;
    font-size: 0.95em;
    white-space: nowrap;
    overflow: visible;
}

.time-header {
    background: #764ba2;
    text-overflow: clip;
    padding: 4px 6px;
    min-height: auto;
    height: auto;
    line-height: 1.2;
}

.time-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    position: relative;
    height: 24px;
    max-width: 100%;
}

.time-slot:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.time-slot.drag-highlight {
    background: #e3f2fd;
    border-color: #2196f3;
    border-width: 2px;
}

.time-slot.selected {
    background: #667eea;
}

.time-slot.selected .slot-label {
    background: #667eea;
    color: white;
}

.time-slot input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    margin: 0;
}

.time-slot input[type="checkbox"]:checked + .slot-label {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.slot-label {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: 500;
    border-radius: 3px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 100px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #e8e8e8;
    border-color: #d0d0d0;
}

/* Modal Popup Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideDown 0.3s;
    text-align: center;
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #333;
}

#modal-message {
    font-size: 16px;
    line-height: 1.6;
    padding: 10px 0;
}

.modal-content.success {
    border-top: 4px solid #28a745;
}

.modal-content.error {
    border-top: 4px solid #dc3545;
}

.modal-content.loading {
    border-top: 4px solid #17a2b8;
}

.modal-content.success #modal-message {
    color: #155724;
}

.modal-content.error #modal-message {
    color: #721c24;
}

.modal-content.loading #modal-message {
    color: #0c5460;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .container {
        padding: 10px;
        margin: 0 5px;
        width: calc(100% - 10px);
        max-width: calc(100% - 10px);
        overflow-x: auto;
    }

    .schedule-grid {
        grid-template-columns: 90px repeat(7, minmax(40px, 1fr));
        gap: 3px;
        min-width: 0;
        width: 100%;
    }

    .day-header,
    .time-header {
        padding: 4px 3px;
        font-size: 0.75em;
        overflow: visible;
    }

    .slot-label {
        font-size: 0.8em;
    }

    .time-slot {
        height: 22px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 3px;
    }
    
    .container {
        padding: 8px;
        margin: 0 3px;
        width: calc(100% - 6px);
        max-width: calc(100% - 6px);
    }

    .schedule-grid {
        grid-template-columns: 80px repeat(7, minmax(35px, 1fr));
        gap: 2px;
    }

    .day-header,
    .time-header {
        padding: 3px 2px;
        font-size: 0.7em;
    }

    .time-slot {
        height: 20px;
    }
}
