/* ==========================================================================
   MODERN COMPONENTS - UI ELEMENTS
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons System
   -------------------------------------------------------------------------- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: inherit;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-align: center;
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button-primary {
    background-color: var(--primary-color);
    color: var(--surface);
    box-shadow: 0 1px 2px rgba(207, 116, 82, 0.2);
}

.button-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 6px rgba(207, 116, 82, 0.25);
}

.button-secondary {
    background-color: var(--surface);
    color: var(--slate-700);
    border-color: var(--slate-300);
    box-shadow: var(--shadow-sm);
}

.button-secondary:hover:not(:disabled) {
    background-color: var(--slate-50);
    border-color: var(--slate-400);
}

.button-danger {
    background-color: var(--surface);
    color: var(--error);
    border-color: var(--error-light);
}

.button-danger:hover:not(:disabled) {
    background-color: var(--error-light);
    border-color: var(--error);
}

/* --------------------------------------------------------------------------
   Forms & Inputs
   -------------------------------------------------------------------------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-700);
}

.form-input,
.styled-select {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--slate-900);
    background-color: var(--surface);
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}

.form-input:focus,
.styled-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.form-input:disabled,
.styled-select:disabled {
    background-color: var(--slate-100);
    color: var(--slate-500);
    cursor: not-allowed;
}

.inline-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    text-align: right;
    font-size: 13px;
    transition: border-color 0.2s;
}

.inline-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* --------------------------------------------------------------------------
   Tables - Enterprise Grade
   -------------------------------------------------------------------------- */
.table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    background-color: var(--surface);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    font-size: 13.5px;
}

.data-table th {
    background-color: var(--slate-50);
    color: var(--slate-600);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--slate-200);
    white-space: nowrap;
    text-align: center;
}

.data-table td {
    padding: 12px 16px;
    color: var(--slate-800);
    border-bottom: 1px solid var(--slate-100);
    vertical-align: middle;
    text-align: center;
}

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
    background-color: var(--slate-50);
}

.data-table tfoot td {
    background-color: var(--slate-50);
    font-weight: 600;
    color: var(--slate-900);
    border-top: 2px solid var(--slate-200);
}

/* --------------------------------------------------------------------------
   Status Badges (Tags)
   -------------------------------------------------------------------------- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.status-success {
    background: var(--success-light);
    color: var(--success-text);
}

.status-warning {
    background: var(--warning-light);
    color: var(--warning-text);
}

.status-error {
    background: var(--error-light);
    color: var(--error-text);
}

.status-info {
    background: var(--info-light);
    color: var(--info-text);
}

.status-neutral {
    background: var(--slate-100);
    color: var(--slate-600);
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    /* Slate 900 */
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
}

/* Calendar Modal overlays other modals */
#calendarModal {
    z-index: 10005;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.15s ease-out forwards;
}

.modal-content {
    background-color: var(--surface);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: var(--space-4) var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    margin: 0;
}

.close-modal {
    color: var(--slate-400);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
}

.close-modal:hover {
    color: var(--slate-700);
}

.modal-body {
    padding: var(--space-4);
}

.modal-footer {
    padding: var(--space-3) var(--space-4);
    background-color: var(--slate-50);
    border-top: 1px solid var(--slate-100);
    display: flex;
    justify-content: stretch;
    gap: var(--space-2);
}

.modal-footer .button {
    flex: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.97);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --------------------------------------------------------------------------
   Toasts (Feedback)
   -------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.toast {
    background: var(--slate-800);
    color: var(--surface);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: slideDownToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-success {
    border-bottom: 3px solid var(--success);
}

.toast-error {
    border-bottom: 3px solid var(--error);
    background-color: var(--error);
    color: white;
}

.toast-warning {
    border-bottom: 3px solid var(--warning);
    background-color: var(--warning);
    color: white;
}

.toast-info {
    border-bottom: 3px solid var(--info);
}

@keyframes slideDownToast {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --------------------------------------------------------------------------
   Calendar Modal (Global Setup for Manual Entry & Bulk Edit)
   -------------------------------------------------------------------------- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-2);
    text-align: center;
    margin-bottom: var(--space-4);
}

.calendar-day-header {
    font-weight: bold;
    color: var(--slate-700);
    padding: var(--space-2) 0;
    font-size: 14px;
    border-bottom: 2px solid var(--slate-200);
}

.calendar-day {
    padding: 10px 0;
    cursor: pointer;
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    border: 1px solid var(--slate-200);
    font-size: 14px;
    transition: all 0.2s ease;
    user-select: none;
    color: var(--slate-900);
}

.calendar-day:hover:not(.empty) {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

.calendar-day.selected {
    background-color: var(--primary-color);
    color: var(--surface);
    border-color: var(--primary-hover);
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(207, 116, 82, 0.3);
}

.calendar-day.weekend:not(.selected) {
    color: var(--error);
    background-color: var(--surface);
    border-color: var(--error-light);
}

.calendar-day.empty {
    background: transparent;
    border: none;
    cursor: default;
    pointer-events: none;
}