/*
 * WSW-Photos – design tokens and shared primitives.
 *
 * This sheet is linked after the page-level <style> blocks, so plain
 * class selectors here intentionally re-skin the older page styles.
 * Page-specific rules live in admin.css / booking.css.
 */

:root {
    --ink-1000: #07080a;
    --ink-900: #0b0c0e;
    --ink-800: #15171b;
    --ink-700: #23262c;
    --ink-600: #3d434c;
    --ink-500: #6b7280;
    --ink-400: #98a0ac;
    --ink-300: #c8cdd6;
    --ink-200: #e5e7ec;
    --ink-100: #f1f2f5;

    --paper: #faf9f7;
    --surface: #ffffff;
    --surface-2: #f7f6f3;
    --surface-3: #f2f0ec;

    --line: rgba(11, 12, 14, 0.09);
    --line-strong: rgba(11, 12, 14, 0.16);

    --gold: #b08d57;
    --gold-dark: #8d6f42;
    --gold-soft: rgba(176, 141, 87, 0.14);

    --ok: #1f6f4a;
    --ok-soft: #e9f3ed;
    --warn: #8a6008;
    --warn-soft: #fbf1de;
    --danger: #9f2f2a;
    --danger-soft: #fbecea;
    --info: #2d5aa8;
    --info-soft: #eaf0fa;

    --r-xs: 8px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 26px;
    --r-pill: 999px;

    --sh-1: 0 1px 2px rgba(11, 12, 14, 0.04), 0 2px 6px rgba(11, 12, 14, 0.05);
    --sh-2: 0 2px 4px rgba(11, 12, 14, 0.04), 0 10px 28px rgba(11, 12, 14, 0.07);
    --sh-3: 0 16px 40px rgba(11, 12, 14, 0.12), 0 40px 80px rgba(11, 12, 14, 0.12);

    --font-sans:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Inter,
        "Helvetica Neue",
        Arial,
        sans-serif;

    --font-display:
        ui-serif,
        "Iowan Old Style",
        "Palatino Linotype",
        Palatino,
        Georgia,
        "Times New Roman",
        serif;

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--paper);
    color: var(--ink-900);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1, "liga" 1;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink-900);
}

h1 {
    line-height: 1.12;
}

h4,
h5,
h6 {
    letter-spacing: -0.01em;
}

a {
    color: var(--ink-900);
    text-decoration-color: var(--line-strong);
    text-underline-offset: 3px;
}

::selection {
    background: var(--gold-soft);
    color: var(--ink-900);
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                            */
/* ------------------------------------------------------------------ */

button,
.btn-primary,
.btn-save,
.btn-details,
.btn-edit,
.btn-secondary,
.btn-confirm,
.btn-complete,
.btn-cancel,
.btn-delete,
.btn-delivered,
.btn-returning,
.btn-review,
.btn-add,
.save-button,
.upload-button,
.new-button,
.back-button,
.action-button,
.refresh-button,
.create-actions button,
.edit-actions button,
.modal-actions button {
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.005em;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    padding: 10px 16px;
    cursor: pointer;
    transition:
        background 0.16s var(--ease),
        border-color 0.16s var(--ease),
        color 0.16s var(--ease),
        box-shadow 0.16s var(--ease),
        transform 0.16s var(--ease);
}

button:active,
.back-button:active,
.action-button:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Solid ink – primary intent */
.btn-primary,
.btn-save,
.btn-confirm,
.btn-add,
.save-button,
.new-button,
.refresh-button,
.create-actions .btn-primary,
#createCustomerButton,
#create-service-button,
#saveEditButton,
#saveAvailability {
    background: var(--ink-900);
    border-color: var(--ink-900);
    color: #fff;
    box-shadow: var(--sh-1);
}

.btn-primary:hover,
.btn-save:hover,
.btn-confirm:hover,
.btn-add:hover,
.save-button:hover,
.new-button:hover,
.refresh-button:hover {
    background: var(--ink-1000);
    box-shadow: var(--sh-2);
}

/* Quiet – secondary intent */
.btn-details,
.btn-edit,
.btn-secondary,
.btn-review,
.btn-returning,
.btn-delivered,
.upload-button,
.back-button,
.action-button {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink-800);
}

.btn-details:hover,
.btn-edit:hover,
.btn-secondary:hover,
.btn-review:hover,
.btn-returning:hover,
.btn-delivered:hover,
.upload-button:hover,
.back-button:hover,
.action-button:hover {
    background: var(--surface-2);
    border-color: var(--ink-300);
    color: var(--ink-900);
}

/* Success */
.btn-complete {
    background: var(--ok-soft);
    border-color: rgba(31, 111, 74, 0.24);
    color: var(--ok);
}

.btn-complete:hover {
    background: #dfeee6;
}

/* Destructive */
.btn-cancel,
.btn-delete {
    background: var(--surface);
    border-color: rgba(159, 47, 42, 0.26);
    color: var(--danger);
}

.btn-cancel:hover,
.btn-delete:hover {
    background: var(--danger-soft);
}

/* ------------------------------------------------------------------ */
/* Form fields                                                        */
/* ------------------------------------------------------------------ */

.form-group label,
.create-field label,
.crm-field label,
.field-label,
.details-label,
.stat-label,
.customer-stat-label,
.booking-label,
.services-total-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-500);
}

.form-group input,
.form-group select,
.form-group textarea,
.create-input,
.create-select,
.create-textarea,
.edit-input,
.edit-textarea,
.crm-select,
.toolbar input,
.toolbar select,
.search input,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="password"],
select,
textarea {
    font-family: inherit;
    font-size: 14px;
    color: var(--ink-900);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    padding: 11px 13px;
    transition:
        border-color 0.16s var(--ease),
        box-shadow 0.16s var(--ease),
        background 0.16s var(--ease);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover,
.create-input:hover,
.create-textarea:hover,
.edit-input:hover,
.toolbar input:hover,
.toolbar select:hover {
    border-color: var(--ink-300);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.create-input:focus,
.create-select:focus,
.create-textarea:focus,
.edit-input:focus,
.edit-textarea:focus,
.crm-select:focus,
.toolbar input:focus,
.toolbar select:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
}

input::placeholder,
textarea::placeholder {
    color: var(--ink-400);
}

input[readonly] {
    background: var(--surface-3);
    color: var(--ink-600);
}

/* ------------------------------------------------------------------ */
/* Surfaces and tables                                                */
/* ------------------------------------------------------------------ */

.card,
.table-wrapper,
.modal-content,
.new-service-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-2);
    color: var(--ink-500);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}

td {
    padding: 15px 16px;
    font-size: 14px;
    color: var(--ink-800);
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

tbody tr {
    transition: background 0.14s var(--ease);
}

tbody tr:hover {
    background: var(--surface-2);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ------------------------------------------------------------------ */
/* Status pills                                                       */
/* ------------------------------------------------------------------ */

.status,
.booking-status,
.activity-status,
.crm-status {
    display: inline-block;
    padding: 5px 11px;
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    background: var(--ink-100);
    color: var(--ink-600);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.status-pending {
    background: var(--warn-soft);
    border-color: rgba(138, 96, 8, 0.2);
    color: var(--warn);
}

.status-unavailable {
    background: var(--ink-100);
    border-color: rgba(90, 74, 50, 0.18);
    color: var(--ink-600);
}

.status-confirmed {
    background: var(--info-soft);
    border-color: rgba(45, 90, 168, 0.2);
    color: var(--info);
}

.status-completed,
.status-available,
.status-active {
    background: var(--ok-soft);
    border-color: rgba(31, 111, 74, 0.2);
    color: var(--ok);
}

.status-cancelled,
.status-blocked {
    background: var(--danger-soft);
    border-color: rgba(159, 47, 42, 0.2);
    color: var(--danger);
}

.status-inactive {
    background: var(--ink-100);
    border-color: var(--line-strong);
    color: var(--ink-500);
}

/* ------------------------------------------------------------------ */
/* Feedback states                                                    */
/* ------------------------------------------------------------------ */

.loading,
.empty,
.chart-empty,
.funnel-empty,
.service-empty,
.services-empty,
.upcoming-empty,
.slots-loading {
    color: var(--ink-500);
    font-size: 14px;
    text-align: center;
    padding: 34px 20px;
}

.error,
.error-message,
.edit-error,
.availability-error,
.message-error {
    background: var(--danger-soft);
    border: 1px solid rgba(159, 47, 42, 0.2);
    border-radius: var(--r-sm);
    color: var(--danger);
    font-size: 14px;
    padding: 13px 15px;
}

.success-message,
.edit-success,
.message-success {
    background: var(--ok-soft);
    border: 1px solid rgba(31, 111, 74, 0.2);
    border-radius: var(--r-sm);
    color: var(--ok);
    font-size: 14px;
    padding: 13px 15px;
}

.info-box,
.edit-info {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--gold);
    border-radius: var(--r-sm);
    color: var(--ink-600);
    font-size: 13px;
    line-height: 1.6;
    padding: 14px 16px;
}

.required {
    color: var(--danger);
}

/* ------------------------------------------------------------------ */
/* App confirm / notice dialog                                        */
/* ------------------------------------------------------------------ */

body.app-dialog-open {
    overflow: hidden;
}

.app-dialog {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.app-dialog[hidden] {
    display: none;
}

.app-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 8, 10, 0.52);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.app-dialog-panel {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    padding: 26px 26px 22px;
    background: #fffdf8;
    border: 1px solid rgba(176, 141, 87, 0.28);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-3);
}

.app-dialog-kicker {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-dark);
}

.app-dialog.is-danger .app-dialog-kicker {
    color: var(--danger);
}

.app-dialog-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink-900);
}

.app-dialog-message {
    margin: 10px 0 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink-600);
}

.app-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(176, 141, 87, 0.18);
}

.app-dialog-actions .btn-primary,
.app-dialog-actions .btn-delete {
    min-width: 118px;
}

/* ------------------------------------------------------------------ */
/* Refined scrollbars on desktop                                      */
@media (hover: hover) and (min-width: 900px) {
    * {
        scrollbar-width: thin;
        scrollbar-color: var(--ink-300) transparent;
    }

    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    ::-webkit-scrollbar-thumb {
        background: var(--ink-300);
        border: 3px solid var(--paper);
        border-radius: var(--r-pill);
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
