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

:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --danger: #f44336;
    --danger-dark: #d32f2f;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-600: #757575;
    --gray-800: #424242;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-sm: 4px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--white);
    padding: 16px 24px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
}

.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Main layout */
.main {
    display: flex;
    flex: 1;
    gap: 24px;
    padding: 24px;
}

/* Sidebar */
.sidebar {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.doctors-panel,
.stats-panel,
.actions-panel {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.doctors-panel h2,
.stats-panel h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--gray-800);
}

.doctors-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.doctor-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.doctor-card:hover {
    background: var(--gray-200);
}

.doctor-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.doctor-name {
    flex: 1;
    font-weight: 500;
}

.doctor-shifts {
    font-size: 0.85rem;
    color: var(--gray-600);
}

.doctor-edit {
    color: var(--gray-400);
    font-size: 1.2rem;
}

/* Stats */
.stats-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stats-placeholder {
    color: var(--gray-600);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.stat-value {
    font-weight: 600;
}

.stat-warning {
    background: #fff3e0;
    color: #e65100;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 8px;
}

/* Actions */
.actions-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Calendar section */
.calendar-section {
    flex: 1;
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    min-width: 0;
}

/* FullCalendar customization */
.fc {
    font-family: inherit;
}

.fc .fc-toolbar-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.fc .fc-button {
    background: var(--gray-200);
    border: none;
    color: var(--gray-800);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
}

.fc .fc-button:hover {
    background: var(--gray-300);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: var(--primary);
    color: var(--white);
}

.fc .fc-daygrid-day {
    cursor: pointer;
}

.fc .fc-daygrid-day:hover {
    background: var(--gray-100);
}

.fc .fc-event {
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-weight: 500;
    cursor: pointer;
}

.fc .fc-daygrid-day-number {
    padding: 8px;
    font-weight: 500;
}

.fc .fc-day-today {
    background: rgba(76, 175, 80, 0.1) !important;
}

.fc .fc-day-today .fc-daygrid-day-number {
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Conflict day */
.fc .fc-day-conflict {
    background: rgba(244, 67, 54, 0.1) !important;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-dark);
}

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

/* Forms */
select {
    padding: 10px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--white);
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--primary);
}

input[type="text"],
input[type="number"],
input[type="date"] {
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    width: 100%;
}

input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-small {
    max-width: 350px;
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-600);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-800);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    border-top: 1px solid var(--gray-200);
}

/* Form groups */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

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

.form-row {
    display: flex;
    gap: 16px;
}

.form-group.half {
    flex: 1;
}

/* Color picker */
.color-picker {
    display: flex;
    gap: 8px;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--gray-800);
}

/* Weekdays picker */
.weekdays-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.weekday-option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.weekday-option:hover {
    background: var(--gray-200);
}

.weekday-option input {
    width: auto;
}

.weekday-option input:checked + span {
    font-weight: 600;
}

/* Dates input */
.dates-input {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.dates-input input {
    flex: 1;
}

.dates-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.date-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--gray-200);
    border-radius: 20px;
    font-size: 0.85rem;
}

.date-tag.preferred {
    background: rgba(76, 175, 80, 0.2);
    color: var(--primary-dark);
}

.date-tag-remove {
    background: none;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.date-tag-remove:hover {
    color: var(--danger);
}

/* Shift modal */
.shift-date {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 16px;
    text-align: center;
}

.shift-doctors-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shift-doctor-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
    border: 2px solid transparent;
}

.shift-doctor-option:hover {
    background: var(--gray-200);
}

.shift-doctor-option.selected {
    border-color: var(--primary);
    background: rgba(76, 175, 80, 0.1);
}

.shift-doctor-option.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
}

.shift-doctor-option .doctor-color {
    width: 16px;
    height: 16px;
}

.shift-doctor-option .doctor-name {
    font-weight: 500;
}

.shift-doctor-option .doctor-status {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-left: auto;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-600);
}

/* Login error */
.login-error {
    color: var(--danger);
    font-size: 0.9rem;
    margin-bottom: 16px;
    text-align: center;
}

.login-error.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 900px) {
    .main {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }
}
