* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 100vh;
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        padding: 10px;
    }
}

.panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
}

.panel-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #2563eb;
}

/* Calendar Styles */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.nav-btn {
    background: #f3f4f6;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    min-height: 44px;
    min-width: 44px;
}

.nav-btn:hover {
    background: #e5e7eb;
}

.nav-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

#monthLabel {
    font-size: 16px;
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 20px;
}

.calendar-header-cell {
    text-align: center;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

.day {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 8px 4px;
    text-align: center;
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.day:hover {
    background: #e0e7ff;
}

.day:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.day.is-today {
    background: #dbeafe;
    font-weight: 600;
    color: #1d4ed8;
}

.day.is-selected {
    background: #2563eb;
    color: white;
}

.day.is-multi-selected {
    background: #8b5cf6;
    color: white;
    font-weight: 600;
}

.day.is-other-month {
    color: #9ca3af;
    background: #f3f4f6;
}

.day.is-weekend {
    color: #dc2626;
}

.day.is-saturday {
    color: #0891b2;
}

/* Quick Days */
.quick-days {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.quick-btn {
    background: #f3f4f6;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    min-height: 44px;
    flex: 1;
}

.quick-btn:hover {
    background: #e5e7eb;
}

.quick-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Time Presets */
.time-presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafafa;
}

.time-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}

.time-btn {
    background: #f3f4f6;
    border: none;
    border-radius: 4px;
    padding: 8px 4px;
    cursor: pointer;
    font-size: 12px;
    min-height: 36px;
    transition: all 0.2s;
    white-space: nowrap;
}

.time-btn:hover {
    background: #e5e7eb;
}

.time-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Duration Buttons */
.duration-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.duration-btn {
    background: #eff6ff;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    min-height: 32px;
    color: #3b82f6;
    transition: all 0.2s;
    white-space: nowrap;
}

.duration-btn:hover {
    background: #dbeafe;
    border-color: #2563eb;
    color: #2563eb;
}

.duration-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Selected Chips */
.chips-container {
    min-height: 60px;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.candidate-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.candidate-item:hover {
    background: #f3f4f6;
}

.candidate-index {
    font-weight: 600;
    color: #6b7280;
    min-width: 24px;
    font-size: 14px;
}

.candidate-text {
    flex: 1;
    font-size: 14px;
    color: #374151;
}

.candidate-remove {
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 12px;
    min-height: 32px;
    transition: background-color 0.2s;
}

.candidate-remove:hover {
    background: #b91c1c;
}

.candidate-remove:focus-visible {
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

.chip {
    background: #2563eb;
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chip-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
}

.chip-remove:hover {
    background: rgba(255,255,255,0.2);
}

.chip-remove:focus-visible {
    outline: 1px solid white;
}

.chips-empty {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    width: 100%;
    padding: 12px;
}

.chips-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.btn-clear {
    padding: 8px 16px;
    min-height: 36px;
    font-size: 13px;
}

/* Preview Panel */
#preview {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 16px;
}

#preview:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    min-height: 44px;
    transition: all 0.2s;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Add Single Time Button */
.btn-add-single {
    background: #059669;
    color: white;
    border: 1px solid #047857;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    min-height: 36px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-add-single:hover {
    background: #047857;
    border-color: #065f46;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.btn-add-single:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-add-single:focus-visible {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

.btn-add-single:disabled {
    background: #d1d5db;
    color: #6b7280;
    border-color: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-add-no-time {
    background: #6366f1;
    color: white;
    border: 1px solid #4f46e5;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    min-height: 36px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-add-no-time:hover {
    background: #4f46e5;
    border-color: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.btn-add-no-time:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-add-no-time:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.btn-add-no-time:disabled {
    background: #d1d5db;
    color: #6b7280;
    border-color: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.time-range-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Settings Modal */
#settingsModal {
    border: none;
    border-radius: 8px;
    padding: 0;
    max-width: 500px;
    width: 90vw;
}

#settingsModal::backdrop {
    background: rgba(0,0,0,0.5);
}

.modal-header {
    padding: 20px 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f3f4f6;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
}

.form-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-checkbox:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    min-height: 44px;
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.modal-footer {
    padding: 0 20px 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Toast */
#toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #059669;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s;
    z-index: 1000;
}

#toast.show {
    opacity: 1;
    transform: translateX(0);
}

#toast.error {
    background: #dc2626;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Multi-date selection buttons */
.btn-toggle-multi {
    background: #eff6ff;
    border: 2px solid #3b82f6;
    color: #1e40af;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-toggle-multi:hover {
    background: #dbeafe;
    border-color: #2563eb;
}

.btn-toggle-multi:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.btn-multi-cancel {
    background: #fef2f2;
    border: 1px solid #ef4444;
    color: #dc2626;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    min-height: 28px;
    transition: all 0.2s;
}

.btn-multi-cancel:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

.btn-multi-cancel:focus-visible {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

.btn-multi-action {
    background: #8b5cf6;
    color: white;
    border: 1px solid #7c3aed;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    min-height: 36px;
    transition: all 0.2s;
    flex: 1;
}

.btn-multi-action:hover {
    background: #7c3aed;
    border-color: #6d28d9;
}

.btn-multi-action:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

.btn-multi-action:disabled {
    background: #d1d5db;
    color: #6b7280;
    border-color: #d1d5db;
    cursor: not-allowed;
}
