/**
 * Tattoo Studio Management System - Minimalist Black & White Design
 */

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-bg: #ffffff;
    --color-text: #000000;
    --color-border: #e0e0e0;
    --color-hover: #f5f5f5;
    --color-primary: #000000;
    --color-secondary: #666666;
    --color-success: #32CD32;
    --color-warning: #FFD700;
    --color-error: #dc3545;
    --color-info: #008B8B;
    --color-purple: #9370DB;
    --spacing-unit: 1rem;
    --border-radius: 4px;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Header */
.main-header {
    background-color: var(--color-bg);
    border-bottom: 2px solid var(--color-text);
    padding: var(--spacing-unit) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-text);
    text-decoration: none;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-unit);
}

.main-nav a {
    color: var(--color-text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.main-nav a:hover {
    border-color: var(--color-text);
    background-color: var(--color-hover);
}

.user-info {
    color: var(--color-secondary);
    padding: 0 1rem;
}

.btn-logout {
    background-color: var(--color-bg);
    color: var(--color-text);
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-text);
}

.btn-logout:hover {
    background-color: var(--color-text);
    color: var(--color-bg);
}

/* Hamburger toggle — hidden on desktop */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    flex-direction: column;
    gap: 5px;
}

.menu-toggle-bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-text);
    border-radius: 2px;
    transition: transform 0.3s;
}

/* Sidebar overlay — hidden on desktop */
.sidebar-overlay {
    display: none;
}

/* Sidebar close button — hidden on desktop */
.sidebar-close {
    display: none;
}

/* Sidebar user block — hidden on desktop (shown via .user-info instead) */
.sidebar-user-info {
    display: none;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-unit);
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--color-bg);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: var(--spacing-unit);
}

.login-box {
    border: 2px solid var(--color-text);
    padding: 2rem;
    text-align: center;
}

.login-box h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-box h2 {
    font-size: 1rem;
    font-weight: normal;
    color: var(--color-secondary);
    margin-bottom: 2rem;
}

/* Forms */
.form-group {
    margin-bottom: var(--spacing-unit);
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-text);
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: inherit;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-width: 2px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-unit);
    margin-bottom: var(--spacing-unit);
}

.form-actions {
    display: flex;
    gap: var(--spacing-unit);
    justify-content: flex-end;
    margin-top: var(--spacing-unit);
}

/* Appointment Type Buttons */
.appointment-type-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.appointment-type-buttons input[type="radio"] {
    display: none;
}

.appointment-type-buttons .type-button {
    flex: 1;
    min-width: 150px;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--color-text);
    background-color: var(--color-bg);
    color: var(--color-text);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: 0;
    user-select: none;
}

.appointment-type-buttons .type-button:hover {
    background-color: var(--color-hover);
}

.appointment-type-buttons input[type="radio"]:checked + .type-button {
    background-color: var(--color-text);
    color: var(--color-bg);
}

.appointment-type-buttons input[type="radio"]:focus + .type-button {
    outline: 2px solid var(--color-text);
    outline-offset: 2px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--color-text);
    background-color: var(--color-bg);
    color: var(--color-text);
    text-decoration: none;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn:hover {
    background-color: var(--color-text);
    color: var(--color-bg);
}

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

.btn-primary:hover {
    background-color: var(--color-bg);
    color: var(--color-text);
}

.btn-secondary {
    background-color: var(--color-bg);
    color: var(--color-text);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-warning {
    background-color: var(--color-warning);
    color: var(--color-text);
    border-color: var(--color-warning);
}

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

.btn-error:hover {
    background-color: #cc0000;
    color: white;
    border-color: #cc0000;
}

.btn-warning:hover {
    background-color: #DAA520;
    border-color: #DAA520;
    color: var(--color-text);
}

.btn-success {
    background-color: var(--color-success);
    color: var(--color-text);
    border-color: var(--color-success);
}

.btn-danger {
    background-color: var(--color-bg);
    color: var(--color-error);
    border-color: var(--color-error);
}

.btn-danger:hover {
    background-color: var(--color-error);
    color: var(--color-bg);
}

.btn-small {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

/* Modal (popup) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.modal-open {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--color-bg);
    border: 2px solid var(--color-text);
    padding: 1.5rem;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.modal-message {
    margin-bottom: 1rem;
    color: var(--color-secondary);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-unit);
    margin-top: 1rem;
    flex-wrap: wrap;
}

.artists-actions {
    white-space: nowrap;
}

.artists-actions .btn {
    margin-right: 0.25rem;
}

.artists-actions .btn:last-child {
    margin-right: 0;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: var(--spacing-unit);
    border: 2px solid var(--color-text);
}

.alert-success {
    background-color: var(--color-bg);
    border-color: var(--color-success);
    color: var(--color-text);
}

.alert-error {
    background-color: var(--color-bg);
    border-color: var(--color-error);
    color: var(--color-text);
}

.alert-info {
    background-color: var(--color-bg);
    border-color: #3b82f6;
    color: var(--color-text);
}

/* ===================== Calendar (Google-Calendar style) ===================== */

.calendar-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px);  /* full viewport minus header */
    padding-bottom: 0;
    overflow: hidden;
    transition: padding-bottom 0.2s ease-out;
}

.calendar-container.has-register-bar {
    padding-bottom: 70px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    flex-shrink: 0;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calendar-nav .btn {
    height: 44px;
    min-width: 44px;
    padding: 0.75rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.week-range {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
}

.calendar-artist-select {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calendar-artist-select label {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.calendar-artist-select-input {
    padding: 0.4rem 0.6rem;
    font-size: 0.95rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 140px;
}

/* ---------- Calendar component (single scroll container) ---------- */
.cal {
    flex: 1;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: auto;
    min-height: 0;
    position: relative;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 50px; /* Ajuste para el gutter en mobile */
}

/* Custom scrollbar */
.cal::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.cal::-webkit-scrollbar-track { background: var(--color-bg); }
.cal::-webkit-scrollbar-thumb { background: var(--color-secondary); border-radius: 3px; }
.cal::-webkit-scrollbar-thumb:hover { background: var(--color-text); }

/* CSS Grid: 1 gutter column + 7 day columns */
.cal-grid {
    display: grid;
    grid-template-columns: 60px repeat(7, minmax(100px, 1fr));
    min-width: min-content;
}

/* --- Header row (sticky top) --- */
.cal-corner {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 50;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    border-bottom: 2px solid var(--color-text);
}

.cal-header-day {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-text);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 12px 8px;
    user-select: none;
    scroll-snap-align: start;
}

.cal-header-day:last-child {
    border-right: none;
}

.cal-day-name {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--color-secondary);
}

.cal-day-number {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}

.cal-header-day.is-today {
    background: var(--color-text);
}

.cal-header-day.is-today .cal-day-name,
.cal-header-day.is-today .cal-day-number {
    color: var(--color-bg);
}

/* --- Gutter hours (sticky left) --- */
.cal-gutter-hour {
    position: sticky;
    left: 0;
    z-index: 30;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.cal-gutter-hour span {
    position: absolute;
    top: -10px;
    right: 8px;
    font-size: 0.7rem;
    color: var(--color-secondary);
    line-height: 1;
    pointer-events: none;
    background: var(--color-bg);
    padding: 2px 4px;
}

/* First gutter cell: label at top */
.cal-grid > .cal-gutter-hour:nth-child(9) span {
    top: 4px;
}

/* --- Day cells --- */
.cal-cell {
    position: relative;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.cal-cell:nth-child(8n+8) {
    border-right: none; /* last column each row */
}

.cal-cell.is-today {
    background: rgba(0,0,0,0.02);
}

/* Two half-hour cells per hour cell */
.cal-half-row {
    height: 50%;
    cursor: pointer;
    transition: background 0.1s;
}

.cal-half-row:first-child {
    border-bottom: 1px dotted var(--color-border);
}

.cal-half-row:hover {
    background: rgba(0,0,0,0.04);
}

/* Fully booked slots */
.cal-half-row.fully-booked {
    background: repeating-linear-gradient(
        45deg,
        #d4cfc8,
        #d4cfc8 10px,
        #e0dbd4 10px,
        #e0dbd4 20px
    );
    cursor: not-allowed;
}

.cal-half-row.fully-booked:hover {
    background: repeating-linear-gradient(
        45deg,
        #d4cfc8,
        #d4cfc8 10px,
        #e0dbd4 10px,
        #e0dbd4 20px
    );
}

/* Selected time slot */
.cal-half-row.selected {
    background: color-mix(in srgb, var(--waiting-color, #008B8B) 15%, transparent) !important;
    cursor: pointer;
    position: relative;
}

.cal-half-row.selected:first-child {
    border-bottom-color: color-mix(in srgb, var(--waiting-color, #008B8B) 20%, transparent);
}

/* Time label inside selected slots */
.cal-half-row .time-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 500;
    color: #4A423D;
    opacity: 0.85;
    white-space: nowrap;
    pointer-events: none;
    letter-spacing: 0.3px;
}

/* --- Day overlay (for events + time line) --- */
.cal-day-overlay {
    position: absolute;
    top: 0;
    pointer-events: none;
    z-index: 5;
}

.cal-day-overlay .cal-event {
    pointer-events: auto;
}

/* --- Events / appointments --- */
.cal-event {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 5;
    border-radius: 0;
    padding: 4px 6px;
    cursor: pointer;
    overflow: hidden;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 0.75rem;
    line-height: 1.3;
    border-left: 3px solid rgba(0,0,0,0.25);
}

.cal-event:hover {
    z-index: 6;
}

.cal-event strong {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-event span {
    font-size: 0.675rem;
    opacity: 0.9;
}

/* Past appointments */
.cal-event.is-past {
    opacity: 0.5;
}

/* --- Current time indicator --- */
.cal-current-time-line {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: none;
    display: flex;
    align-items: center;
}

.cal-current-time-line::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #C84741;
    box-shadow: 0 1px 3px rgba(200, 71, 65, 0.4);
}

.cal-current-time-circle {
    position: absolute;
    left: -6px;
    width: 12px;
    height: 12px;
    background: #C84741;
    border-radius: 50%;
    border: 2px solid #EFEBE6;
    box-shadow: 0 1px 3px rgba(200, 71, 65, 0.4);
}

/* --- Floating register bar --- */
.cal-register-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-top: 2px solid var(--color-text);
    padding: 0.75rem var(--spacing-unit);
    z-index: 200;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.cal-register-bar.visible {
    display: flex;
}

.cal-register-info {
    display: none;
}

.cal-register-actions {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.cal-register-actions .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
    box-sizing: border-box;
}

/* --- Legend --- */
.legend-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.legend-modal.active {
    display: flex;
}

.legend-modal-content {
    background: white;
    border-radius: 8px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.legend-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #ddd;
}

.legend-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: black;
}

.legend-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: black;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.legend-modal-close:hover {
    opacity: 0.6;
}

.legend-modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    color: black;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.legend-item:hover {
    background: #f5f5f5;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.2);
    flex-shrink: 0;
}

/* --- Monthly calendar modal --- */
.monthly-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(20, 20, 22, 0.45);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.monthly-modal.active {
    display: flex;
}

.monthly-modal-content {
    width: min(980px, 100%);
    max-height: min(90vh, 900px);
    overflow: auto;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #ece7e2;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.14);
    padding: 1rem;
}

.monthly-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.monthly-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1f1f24;
}

.monthly-modal-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.monthly-modal-close {
    width: 40px;
    height: 40px;
    border: 1px solid #dad3cb;
    border-radius: 999px;
    background: #fff;
    color: #2c2c31;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.monthly-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
}

.monthly-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #7a7269;
    letter-spacing: 0.03em;
    padding: 0.25rem 0;
}

.monthly-day {
    min-height: 118px;
    border: 1px solid #eee7e1;
    border-radius: 12px;
    background: #fcfbfa;
    padding: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.monthly-day.is-empty {
    background: transparent;
    border-style: dashed;
    border-color: #f1ece7;
}

.monthly-day.is-today {
    border-color: #0f172a;
    box-shadow: inset 0 0 0 1px #0f172a;
}

.monthly-day-number {
    font-size: 0.85rem;
    font-weight: 700;
    color: #242429;
}

.monthly-day-artists {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-content: flex-start;
}

.monthly-artist-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    font-size: 0.72rem;
    font-weight: 500;
    color: #2b2b31;
    background: color-mix(in srgb, var(--chip-color, #7b7b7b) 16%, #ffffff);
    border: 1px solid color-mix(in srgb, var(--chip-color, #7b7b7b) 35%, #ffffff);
    border-radius: 999px;
    padding: 0.16rem 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.monthly-artist-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.monthly-artist-more {
    font-size: 0.68rem;
    font-weight: 600;
    color: #645d55;
    line-height: 1;
}

.monthly-day-details {
    display: none;
}

@media (max-width: 768px) {
    .monthly-modal {
        padding: 0.35rem;
        align-items: stretch;
    }

    .monthly-modal-content {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 12px;
        padding: 0.7rem;
    }

    .monthly-modal-header {
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 2;
        padding-bottom: 0.45rem;
        margin-bottom: 0.55rem;
    }

    .monthly-modal-header h3 {
        font-size: 1.05rem;
    }

    .monthly-grid {
        gap: 0.3rem;
    }

    .monthly-weekday {
        font-size: 0.69rem;
        padding: 0.2rem 0;
    }

    .monthly-day {
        min-height: 84px;
        border-radius: 10px;
        padding: 0.4rem 0.35rem;
    }

    .monthly-day.is-clickable {
        cursor: pointer;
    }

    .monthly-day-number {
        font-size: 0.82rem;
    }

    .monthly-day-artists {
        gap: 0.25rem;
    }

    .monthly-artist-chip {
        display: none;
    }

    .monthly-day-details.active {
        display: block;
        position: sticky;
        bottom: 0;
        z-index: 3;
        margin-top: 0.55rem;
        padding: 0.6rem 0.7rem;
        border: 1px solid #e5ddd5;
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 -6px 14px rgba(0, 0, 0, 0.08);
    }

    .monthly-day-details strong {
        display: block;
        margin-bottom: 0.35rem;
        color: #2a2a30;
        font-size: 0.8rem;
    }

    .monthly-day-details p {
        margin: 0;
        font-size: 0.75rem;
        color: #6a645f;
    }

    .monthly-day-details-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem 0.6rem;
    }

    .monthly-day-details-item {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.74rem;
        color: #2f2f36;
    }

    .monthly-day-details-dot {
        width: 9px;
        height: 9px;
        border-radius: 50%;
        border: 1px solid rgba(0, 0, 0, 0.18);
        flex-shrink: 0;
    }
}

/* Appointment Forms */
.appointment-form {
    max-width: 800px;
    margin: 0 auto;
}

.appointment-details {
    max-width: 900px;
    margin: 0 auto;
}

.appointment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-unit);
    padding-bottom: var(--spacing-unit);
    border-bottom: 2px solid var(--color-text);
}

.appointment-status {
    padding: 0.5rem 1rem;
    color: white;
    font-weight: 600;
    border-radius: var(--border-radius);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-unit);
    margin-bottom: var(--spacing-unit);
}

.detail-item {
    padding: var(--spacing-unit);
    border: 1px solid var(--color-border);
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-secondary);
    font-size: 0.875rem;
}

.detail-item div {
    font-size: 1.125rem;
}

.attachment-image {
    max-width: 100%;
    max-height: 400px;
    border: 1px solid var(--color-border);
    margin-top: 0.5rem;
}

.appointment-actions {
    display: flex;
    gap: var(--spacing-unit);
    flex-wrap: wrap;
    margin-top: var(--spacing-unit);
    padding-top: var(--spacing-unit);
    border-top: 1px solid var(--color-border);
}

.appointment-actions form {
    display: inline-flex;
}

.appointment-actions .btn {
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* Payment Page */
.payment-info {
    max-width: 600px;
    margin: 0 auto 2rem;
    border: 2px solid var(--color-text);
    padding: 2rem;
}

.payment-form {
    max-width: 600px;
    margin: 0 auto;
}

.payment-summary {
    margin-bottom: var(--spacing-unit);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
}

.summary-item.highlight {
    font-weight: 600;
    font-size: 1.125rem;
    border-bottom: 2px solid var(--color-text);
    margin-top: 0.5rem;
}

.payment-instructions {
    margin-top: var(--spacing-unit);
    padding-top: var(--spacing-unit);
    border-top: 1px solid var(--color-border);
}

.payment-instructions ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

/* Dashboard */
.dashboard-filters {
    margin-bottom: var(--spacing-unit);
    padding: var(--spacing-unit);
    border: 1px solid var(--color-border);
    box-sizing: border-box;
    overflow: hidden;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--color-text);
    background-color: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: var(--border-radius);
}

.filter-btn:hover {
    background-color: var(--color-hover);
}

.filter-btn.active {
    background-color: var(--color-text);
    color: var(--color-bg);
    border-color: var(--color-text);
}

.custom-date-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    box-sizing: border-box;
    width: 100%;
}

.custom-date-form .form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    max-width: 100%;
    box-sizing: border-box;
}

.custom-date-form .form-group {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

.custom-date-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.custom-date-form .form-group input[type="date"] {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--color-text);
    background-color: var(--color-bg);
    font-size: 1rem;
    border-radius: var(--border-radius);
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.custom-date-form .form-group .btn {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem 1.5rem;
    box-sizing: border-box;
}

.filter-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: var(--color-hover);
    border-radius: var(--border-radius);
    text-align: center;
}

.filter-info p {
    margin: 0;
    color: var(--color-secondary);
}

.filter-form .form-row {
    align-items: flex-end;
}

.dashboard-stats-totals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-unit);
    margin-bottom: var(--spacing-unit);
}

.dashboard-stats-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-unit);
    margin-bottom: 2rem;
}

.stat-card {
    border: 2px solid var(--color-text);
    padding: var(--spacing-unit);
    text-align: center;
    border-left-width: 4px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.dashboard-appointments {
    margin-top: 2rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid var(--color-text);
    overflow-x: auto;
    display: block;
}

.data-table thead,
.data-table tbody,
.data-table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.data-table th {
    background-color: var(--color-hover);
    font-weight: 600;
    border-bottom: 2px solid var(--color-text);
}

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

.artists-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-unit);
    margin-bottom: var(--spacing-unit);
}

.artists-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-unit);
    align-items: start;
}

.panel {
    border: 1px solid var(--color-border);
    padding: var(--spacing-unit);
}

.panel h2 {
    margin-bottom: 0.75rem;
}

.inline-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: var(--spacing-unit);
}

.inline-form .form-group {
    margin-bottom: 0;
}

.type-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--color-text);
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    color: white;
    font-weight: 500;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
}

.status-badge-clickable {
    transition: all 0.3s ease;
}

.status-badge-clickable:hover {
    transform: scale(1.05);
    opacity: 0.9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.status-badge-clickable:active {
    transform: scale(0.95);
}

.text-center {
    text-align: center;
}

/* Artists Page */
.artists-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-unit);
}

.artists-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.panel {
    border: 2px solid var(--color-text);
    padding: 1.5rem;
    background-color: var(--color-bg);
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: auto;
}

.panel h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.inline-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    flex-wrap: nowrap;
    width: 100%;
}

.inline-form .form-group {
    margin-bottom: 0;
}

.inline-form .form-group:first-child {
    flex: 1;
}

.inline-form .form-group:last-child {
    flex: 0 0 auto;
}

.inline-form .form-group select {
    width: 100%;
}

.inline-form .form-group .btn {
    white-space: nowrap;
}

.type-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background-color: var(--color-text);
    color: var(--color-bg);
    font-weight: 600;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    min-width: 2rem;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    /* Dashboard stats - stack vertically on mobile */
    .dashboard-stats-totals,
    .dashboard-stats-status {
        grid-template-columns: 1fr;
    }

    /* Artists page responsive */
    .artists-header h1 {
        font-size: 1.5rem;
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch !important;
    }

    .inline-form .form-group {
        width: 100%;
    }

    .inline-form .form-group select,
    .inline-form .form-group .btn {
        width: 100%;
    }

    /* Artists table - card style on mobile */
    .artists-table {
        display: block;
        width: 100%;
        border: none;
    }

    .artists-table thead {
        display: none;
    }

    .artists-table tbody {
        display: block;
    }

    .artists-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 2px solid var(--color-text);
        border-radius: var(--border-radius);
        padding: 0;
        background-color: var(--color-bg);
    }

    .artists-table tbody tr:hover {
        background-color: var(--color-bg);
    }

    .artists-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
        border: none;
        border-bottom: 1px solid var(--color-border);
        text-align: left;
    }

    .artists-table tbody td:last-child {
        border-bottom: none;
    }

    .artists-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-secondary);
        font-size: 0.875rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    .artists-table .type-badge {
        font-size: 0.875rem;
        padding: 0.25rem 0.5rem;
    }

    .artists-table .status-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Calendar container */
    .calendar-container {
        height: calc(100vh - 60px);
        padding: 0.5rem;
    }

    /* En móvil el snapping lo maneja JS (axis-lock + animación).
       Desactivamos el snap CSS nativo para que no pelee con el JS,
       y bloqueamos el overscroll del navegador que "roba" el toque en scrollTop=0. */
    .cal {
        scroll-snap-type: none;
        scroll-padding-left: 0;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: auto;
    }

    /* Show 3 days on mobile — each column gets 1/3 of visible space */
    .cal-grid {
        grid-template-columns: 50px repeat(7, calc((100vw - 50px - 2rem) / 3));
    }

    .cal-corner,
    .cal-gutter-hour {
        width: auto; /* let grid size them */
    }

    .cal-header-day {
        padding: 10px 4px;
        scroll-snap-align: none;
    }

    .cal-day-name {
        font-size: 0.55rem;
    }

    .cal-day-number {
        font-size: 0.9rem;
    }

    /* Reduce event font size on mobile */
    .cal-event {
        font-size: 0.65rem;
        padding: 2px 4px;
    }

    .cal-event strong {
        font-size: 0.7rem;
    }

    .cal-event span {
        font-size: 0.6rem;
    }

    /* Time gutter on mobile - smaller and no wrap */
    .cal-gutter-hour span {
        font-size: 0.6rem;
        right: 2px;
        white-space: nowrap;
        top: -8px;
        padding: 1px 2px;
    }

    .cal-grid > .cal-gutter-hour:nth-child(9) span {
        top: 2px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* ---- Mobile header: slim bar + sidebar drawer ---- */
    .main-header {
        padding: 0.6rem 0;
    }

    .header-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0;
    }

    .menu-toggle {
        display: flex;
    }

    /* Hide the inline .user-info span on mobile (info is in sidebar) */
    .main-nav .user-info {
        display: none;
    }

    /* Sidebar overlay */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    .sidebar-overlay.is-visible {
        opacity: 1;
        visibility: visible;
    }

    /* Sidebar nav drawer */
    .main-nav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100%;
        background-color: var(--color-bg);
        border-left: 2px solid var(--color-text);
        z-index: 1000;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
        transition: right 0.3s ease;
        overflow-y: auto;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    }

    .main-nav.is-open {
        right: 0;
    }

    /* Close button inside sidebar */
    .sidebar-close {
        display: block;
        background: none;
        border: none;
        font-size: 2rem;
        cursor: pointer;
        color: var(--color-text);
        align-self: flex-end;
        padding: 0.75rem 1rem 0;
        line-height: 1;
    }

    /* User info block at top of sidebar */
    .sidebar-user-info {
        display: flex;
        flex-direction: column;
        padding: 1rem 1.25rem 1.25rem;
        border-bottom: 1px solid var(--color-border);
        font-weight: 600;
        font-size: 1rem;
        color: var(--color-text);
    }

    .sidebar-user-info small {
        font-weight: 400;
        font-size: 0.8rem;
        color: var(--color-secondary);
        margin-top: 2px;
    }

    /* Sidebar links */
    .main-nav a {
        padding: 0.9rem 1.25rem;
        border: none;
        border-bottom: 1px solid var(--color-border);
        font-size: 1rem;
    }

    .main-nav a:hover {
        background-color: var(--color-hover);
        border-color: var(--color-border);
    }

    .main-nav .btn-logout {
        margin: 1.25rem;
        text-align: center;
        border: 1px solid var(--color-text);
    }

    .calendar-header {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    .week-range {
        font-size: 0.9rem;
    }

    .calendar-nav {
        display: flex;
        gap: 0.35rem;
    }

    .calendar-nav .btn {
        height: 40px;
        min-width: 40px;
        padding: 0.4rem 0.65rem;
        font-size: 0.85rem;
        text-align: center;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    .cal-register-bar {
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .cal-register-actions {
        width: 100%;
    }

    .cal-register-actions .btn {
        flex: 1;
    }

    .calendar-container.has-register-bar {
        padding-bottom: 90px;
    }

    /* Dashboard responsive */
    .dashboard-filters {
        padding: 0.75rem;
    }

    .filter-buttons {
        flex-direction: column;
    }

    .filter-btn {
        width: 100%;
        text-align: center;
    }

    .custom-date-form {
        padding-left: 0;
        padding-right: 0;
    }

    .custom-date-form .form-row {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0;
    }

    .custom-date-form .form-group {
        width: 100%;
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    .custom-date-form .form-group input[type="date"] {
        width: 100%;
        max-width: 100%;
        padding: 0.6rem;
        font-size: 1rem;
    }

    .custom-date-form .form-group .btn {
        max-width: 100%;
        box-sizing: border-box;
    }

    .filter-info {
        font-size: 0.9rem;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .artists-header {
        flex-direction: column;
        align-items: stretch;
    }

    .artists-layout {
        grid-template-columns: 1fr;
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    /* Mobile appointments: each row scrolls horizontally as its own card */
    .appointments-mobile-scroll {
        display: block;
        width: 100%;
        max-width: 100%;
        border: none;
    }

    .appointments-mobile-scroll thead {
        display: none;
    }

    .appointments-mobile-scroll tbody {
        display: block;
    }

    .appointments-mobile-scroll tbody tr {
        display: block;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 0.85rem;
        border: 2px solid var(--color-text);
        border-radius: var(--border-radius);
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        white-space: nowrap;
        background-color: var(--color-bg);
    }

    .appointments-mobile-scroll tbody td {
        display: inline-flex;
        flex-direction: column;
        gap: 0.35rem;
        width: 170px;
        min-width: 170px;
        box-sizing: border-box;
        padding: 0.85rem 0.75rem;
        border-right: 1px solid var(--color-border);
        border-bottom: none;
        vertical-align: top;
        white-space: normal;
        font-size: 0.9rem;
    }

    .appointments-mobile-scroll tbody td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        color: var(--color-secondary);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    .appointments-mobile-scroll tbody td:last-child {
        border-right: none;
        width: 190px;
        min-width: 190px;
    }

    .appointments-mobile-scroll tbody td[data-label="Actions"] {
        display: inline-flex;
        flex-direction: row;
        align-items: center;
        gap: 0.35rem;
    }

    .appointments-mobile-scroll tbody td[data-label="Actions"]::before {
        display: none;
    }

    .appointments-mobile-scroll tbody td[data-label="Actions"] .btn {
        flex: 1;
        min-width: 72px;
        padding: 0.45rem 0.55rem;
        font-size: 0.78rem;
    }

    .appointments-mobile-scroll .status-badge {
        padding: 0.25rem 0.55rem;
        font-size: 0.72rem;
        width: fit-content;
    }

    .appointments-mobile-scroll .text-center {
        display: block;
        white-space: normal;
        text-align: center;
        width: 100%;
    }
}

/* Tablet screens */
@media (max-width: 768px) and (min-width: 481px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .filter-btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 150px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .cal-grid {
        grid-template-columns: 42px repeat(7, calc((100vw - 42px - 1rem) / 3));
    }

    .cal-day-name {
        font-size: 0.5rem;
    }

    .cal-day-number {
        font-size: 0.8rem;
    }

    /* Even smaller font for hours on very small screens */
    .cal-gutter-hour span {
        font-size: 0.55rem;
        right: 1px;
        padding: 1px;
    }

    .week-range {
        font-size: 0.8rem;
    }

    .calendar-nav .btn {
        height: 36px;
        min-width: 36px;
        font-size: 0.8rem;
        padding: 0.35rem 0.55rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    /* Dashboard on extra small screens */
    .dashboard-filters {
        padding: 0.5rem;
    }

    .filter-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .custom-date-form {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }

    .custom-date-form .form-group input[type="date"] {
        padding: 0.5rem;
        font-size: 0.9rem;
        width: 100%;
    }

    .custom-date-form .form-group .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .filter-info {
        font-size: 0.8rem;
        padding: 0.6rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .btn-sm {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    /* Artists page on extra small screens */
    .artists-header h1 {
        font-size: 1.25rem;
    }

    .panel {
        padding: 1rem;
    }

    .panel h2 {
        font-size: 1.1rem;
    }

    .form-group label {
        font-size: 0.875rem;
    }

    .form-group input,
    .form-group select {
        font-size: 0.9rem;
        padding: 0.6rem;
    }
}

/* Icon Button */
.btn-icon {
    padding: 0.75rem 1.5rem;
    min-width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon i {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: var(--color-bg);
    margin: 5% auto;
    width: 90%;
    max-width: 500px;
    border: 2px solid var(--color-text);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--color-text);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 0.7;
}

.modal-close svg {
    width: 24px;
    height: 24px;
}

.modal-body {
    padding: calc(var(--spacing-unit) * 1.5);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-unit);
    padding: var(--spacing-unit);
    border-top: 1px solid var(--color-border);
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .appointment-actions {
        justify-content: center;
    }
}
