/* ============================================================
   OpenResa Sync — Calendar Styles
   ============================================================ */

:root {
    --ors-free:    #FBED1D;
    --ors-booked:  #EFEEEE;
    --ors-expired: #9ca3af;
    --ors-border:  #e5e7eb;
    --ors-bg:      #ffffff;
    --ors-header:  #181818;
    --ors-radius:  8px;
    --ors-font:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Wrapper */
.ors-calendar-wrap {
    font-family: var(--ors-font);
    font-size: 14px;
    color: #1e293b;
    margin: 1.5em 0;
    position: relative;
}

/* Navigation bar */
.ors-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ors-nav-btn {
    background: #181818;
    color: #FBED1D;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .15s;
}
.ors-nav-btn:hover { opacity: .75; }

.ors-nav-label {
    font-weight: 600;
    font-size: 1em;
    flex: 1;
}

.ors-sync-time {
    font-size: 11px;
    color: #94a3b8;
}

/* Legend */
.ors-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.ors-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #475569;
}

.ors-legend-item::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.ors-legend-item.ors-free::before   { background: #FBED1D; }
.ors-legend-item.ors-booked::before { background: #EFEEEE; border: 1px solid #ccc; }
.ors-legend-item.ors-expired::before{ background: var(--ors-expired); }

/* Scrollable table container */
.ors-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--ors-border);
    border-radius: var(--ors-radius);
}

/* Table */
.ors-table {
    border-collapse: collapse;
    min-width: 100%;
    background: var(--ors-bg);
    table-layout: fixed;
}

.ors-table thead th {
    background: #181818 !important;
    color: #FBED1D !important;
    padding: 10px 6px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
    border-right: 1px solid rgba(255,255,255,.1);
    position: sticky;
    top: 0;
    z-index: 2;
}

.ors-th-court {
    min-width: 100px;
    width: 100px;
}

.ors-th-time {
    width: 58px;
    min-width: 58px;
    position: sticky !important;
    left: 0;
    z-index: 3 !important;
    background: var(--ors-header) !important;
}

/* Time column */
.ors-td-time {
    font-size: 11px;
    font-weight: 600;
    color: #FBED1D;
    text-align: center;
    padding: 4px 6px;
    background: #181818;
    white-space: nowrap;
    border-right: 2px solid var(--ors-border);
    position: sticky;
    left: 0;
    z-index: 1;
    border-bottom: 1px solid var(--ors-border);
}

/* Slot cells */
.ors-td {
    padding: 4px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid var(--ors-border);
    min-width: 100px;
    height: 38px;
    transition: filter .1s;
}

.ors-td.ors-free {
    background: #FBED1D;
    cursor: pointer;
}
.ors-td.ors-free:hover {
    background: #e5d81a;
    filter: brightness(.96);
}

.ors-td.ors-booked {
    background: #EFEEEE;
}

.ors-td.ors-expired {
    background: #f9fafb;
    opacity: .55;
}

.ors-td.ors-na {
    background: #f1f5f9;
}

/* Cell content */
.ors-slot-free {
    font-size: 11px;
    font-weight: 600;
    color: #181818;
}

.ors-slot-label {
    font-size: 11px;
    color: #181818;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.ors-slot-expired {
    color: #9ca3af;
    font-size: 12px;
}

/* Empty state */
.ors-empty {
    padding: 40px;
    text-align: center;
    color: #94a3b8;
    background: #f8fafc;
    border: 1px dashed var(--ors-border);
    border-radius: var(--ors-radius);
}

/* ---------------------------------------------------------------
   Modal
   --------------------------------------------------------------- */
.ors-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ors-modal-inner {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    max-width: 420px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.ors-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #64748b;
}
.ors-modal-close:hover { color: #1e293b; }

.ors-modal-title {
    margin: 0 0 16px;
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}

.ors-modal-body {
    margin-bottom: 20px;
    color: #475569;
    line-height: 1.6;
}

.ors-modal-actions {
    display: flex;
    gap: 10px;
}

/* ---------------------------------------------------------------
   Mobile court filter dropdown
   --------------------------------------------------------------- */
.ors-mobile-court-filter {
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.ors-mobile-court-filter label {
    font-weight: 600;
    font-size: 13px;
    color: #181818;
    white-space: nowrap;
}

.ors-mobile-court-filter select {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #181818;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    background: #FBED1D;
    color: #181818;
    cursor: pointer;
    appearance: auto;
}

/* ---------------------------------------------------------------
   Compact / kiosk mode
   --------------------------------------------------------------- */
.ors-compact .ors-td { height: 28px; min-width: 70px; }
.ors-compact .ors-slot-label,
.ors-compact .ors-slot-free { font-size: 10px; }
.ors-compact .ors-nav-label { font-size: .9em; }

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (max-width: 768px) {
    .ors-mobile-court-filter {
        display: flex;
    }

    /* Hide columns not matching the selected court */
    .ors-table th.ors-court-hidden,
    .ors-table td.ors-court-hidden {
        display: none;
    }

    .ors-table thead th { font-size: 10px; padding: 6px 5px; }
    .ors-td { min-width: 68px; }
    .ors-nav-label { font-size: .85em; }
    .ors-nav { flex-wrap: wrap; }
    .ors-sync-info { width: 100%; }
}

/* ---------------------------------------------------------------
   Admin page
   --------------------------------------------------------------- */
.ors-admin-wrap { max-width: 860px; }

.ors-status-bar {
    display: flex;
    gap: 24px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.ors-status-item { display: flex; flex-direction: column; gap: 2px; }
.ors-label { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em; }
.ors-value { font-size: 14px; font-weight: 600; color: #1e293b; }

.ors-courts-list {
    margin-bottom: 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.ors-court-badge {
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 12px;
}
.ors-court-badge code {
    background: transparent;
    font-size: 11px;
    opacity: .7;
}

/* Modal — wider variant when it holds the reservation form */
.ors-modal-form {
    max-width: 580px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 28px 32px;
}
@media (max-width: 620px) {
    .ors-modal-form { padding: 20px 16px; }
}
