@import 'tailwindcss';

@theme {
    --color-surface-field: oklch(0.98 0.008 145);
    --color-surface-pool: oklch(0.97 0.012 220);
    --color-surface-court: oklch(0.97 0.008 65);
    --color-surface-neutral: oklch(0.98 0.003 260);
    --color-boundary-field: oklch(0.75 0.06 150);
    --color-boundary-pool: oklch(0.70 0.08 230);
    --color-boundary-court: oklch(0.72 0.05 55);
    --color-boundary-neutral: oklch(0.78 0.01 260);
    --color-line-field: oklch(0.90 0.015 145);
    --color-line-pool: oklch(0.88 0.02 220);
    --color-line-court: oklch(0.88 0.015 60);
    --color-line-neutral: oklch(0.90 0.005 260);
}

@layer components {
    .facility-surface {
        display: grid;
        gap: 0;
        border-radius: 0.75rem;
        overflow: hidden;
        border: 2px solid var(--surface-boundary);
        background: var(--surface-bg);
        --surface-line: var(--color-line-neutral);
        --surface-bg: var(--color-surface-neutral);
        --surface-boundary: var(--color-boundary-neutral);
    }

    .facility-surface > * {
        border-color: var(--surface-line);
        min-height: 0;
    }

    .facility-surface--field,
    .facility-surface--outdoor,
    .facility-surface--track {
        --surface-bg: var(--color-surface-field);
        --surface-boundary: var(--color-boundary-field);
        --surface-line: var(--color-line-field);
    }

    .facility-surface--pool {
        --surface-bg: var(--color-surface-pool);
        --surface-boundary: var(--color-boundary-pool);
        --surface-line: var(--color-line-pool);
    }

    .facility-surface--court {
        --surface-bg: var(--color-surface-court);
        --surface-boundary: var(--color-boundary-court);
        --surface-line: var(--color-line-court);
    }

    .facility-surface--gym,
    .facility-surface--hall,
    .facility-surface--room,
    .facility-surface--other {
        --surface-bg: var(--color-surface-neutral);
        --surface-boundary: var(--color-boundary-neutral);
        --surface-line: var(--color-line-neutral);
    }

    .facility-surface--lanes {
        display: flex;
        flex-direction: column;
    }

    .facility-surface--lanes > *:not(:last-child) {
        border-bottom: 2px dashed var(--surface-line);
    }

    .facility-cell--unavailable {
        background-image: repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 5px,
            oklch(0.5 0 0 / 0.08) 5px,
            oklch(0.5 0 0 / 0.08) 6px
        );
    }

    .facility-cell--occupied {
        background-image: repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 6px,
            oklch(0.6 0.15 25 / 0.08) 6px,
            oklch(0.6 0.15 25 / 0.08) 7px
        );
    }

    .facility-cell--selected {
        background-color: oklch(0.92 0.06 250) !important;
        box-shadow: inset 0 0 0 2px oklch(0.60 0.18 250 / 0.6);
    }

    .facility-cell--drop-target {
        background-color: oklch(0.92 0.06 155) !important;
        box-shadow: inset 0 0 0 2px oklch(0.55 0.15 155 / 0.6);
        animation: pulse-drop 1s ease-in-out infinite;
    }

    @keyframes pulse-drop {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.7; }
    }
}

@layer base {
    html {
        direction: rtl;
        scroll-behavior: smooth;
        -webkit-tap-highlight-color: transparent;
    }

    /* Touch-friendly minimum heights */
    input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        min-height: 44px;
    }

    /* Universal button/link press feedback */
    button:not(:disabled),
    [role="button"],
    a[href],
    summary {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    button:not(:disabled):active,
    [role="button"]:active,
    a[href]:active,
    summary:active {
        transform: scale(0.97);
        transition: transform 0.1s ease;
    }

    /* Prevent stuck hover on touch devices */
    @media (hover: none) {
        button:hover,
        a:hover {
            background-color: inherit;
        }
    }
}

@layer utilities {
    .safe-bottom {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .safe-top {
        padding-top: env(safe-area-inset-top, 0px);
    }
    /* Press feedback utility — stronger scale for primary actions */
    .press-feedback:active {
        transform: scale(0.95) !important;
        opacity: 0.9;
    }
}

/* Print: hide all app chrome */
@media print {
    aside, nav, header, .no-print, [data-topbar], .print\:hidden {
        display: none !important;
    }
    main {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    body {
        background: white !important;
    }
    .lg\:ms-64 {
        margin-inline-start: 0 !important;
    }
}
