/* ── Wrap ── */
#tmc-calendario-wrap {
    max-width: 780px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.10);
    padding: 32px 28px 22px;
    font-family: 'Segoe UI', Arial, sans-serif;
    box-sizing: border-box;
    width: 100%;
}

/* ── Header ── */
.tmc-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.tmc-mes-label {
    font-size: 24px;
    font-weight: 700;
    color: #1a2b4a;
    letter-spacing: .5px;
}
.tmc-nav {
    background: #1565C0;
    color: #fff;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    transition: background .2s;
}
.tmc-nav:hover { background: #0D47A1; }

/* ── Grid ── */
.tmc-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 7px;
}
.tmc-dow > div {
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    color: #555;
    padding: 8px 0;
    background: #f1f5fb;
    border-radius: 6px;
}
.tmc-days { margin-top: 7px; }

/* ── Day cells ── */
.tmc-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: default;
    transition: transform .15s, box-shadow .15s;
    min-height: 0;
    overflow: hidden;
}
.tmc-day.empty  { background: transparent; }
.tmc-day.past   { background: #f0f0f0; color: #bbb; }
.tmc-day.sunday { background: #fce4e4; color: #e57373; }
.tmc-day.no-laboral {
    background: #fff3e0;
    color: #e65100;
    border: 2px dashed #ffcc80;
    cursor: not-allowed;
    position: relative;
}
.tmc-day.no-laboral::after {
    content: '✕';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 9px;
    opacity: .6;
}
.tmc-day.avail {
    background: #E8F5E9;
    color: #2E7D32;
    cursor: pointer;
    border: 2px solid #C8E6C9;
}
.tmc-day.avail:hover {
    background: #1565C0;
    color: #fff;
    border-color: #1565C0;
    transform: scale(1.07);
    box-shadow: 0 4px 14px rgba(21,101,192,.30);
}
.tmc-day.today {
    outline: 3px solid #1565C0;
    outline-offset: 2px;
}

/* ── Legend ── */
.tmc-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 18px;
    justify-content: center;
    margin-top: 18px;
    font-size: 13px;
    color: #555;
}
.tmc-dot {
    display: inline-block;
    width: 14px; height: 14px;
    border-radius: 4px;
    margin-right: 5px;
    vertical-align: middle;
    flex-shrink: 0;
}
.dot-ok    { background: #E8F5E9; border: 2px solid #A5D6A7; }
.dot-past  { background: #f0f0f0; border: 2px solid #ddd; }
.dot-nolab { background: #fff3e0; border: 2px dashed #ffcc80; }

/* ── Modal overlay ── */
#tmc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
    animation: tmc-fade-in .2s ease;
    box-sizing: border-box;
}
@keyframes tmc-fade-in { from{opacity:0} to{opacity:1} }

/* ── Modal box ── */
#tmc-modal {
    background: #fff;
    border-radius: 16px;
    padding: 32px 30px 28px;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: tmc-slide-up .25s ease;
    box-sizing: border-box;
}
@keyframes tmc-slide-up { from{transform:translateY(30px);opacity:0} to{transform:translateY(0);opacity:1} }

.tmc-modal-close {
    position: absolute;
    top: 14px; right: 14px;
    background: #f0f0f0;
    border: none;
    width: 36px; height: 36px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    color: #333;
    line-height: 36px;
    text-align: center;
    transition: background .2s;
    z-index: 10;
    /* Override any theme reset */
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.tmc-modal-close:hover { background: #e0e0e0; }

.tmc-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a2b4a;
    margin: 0 0 4px;
    /* leave room for the X button */
    padding-right: 44px;
    display: block;
}
.tmc-modal-date {
    color: #1565C0;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 20px;
}

/* ── Form grid ── */
.tmc-form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 14px;
}
.tmc-field        { display: flex; flex-direction: column; gap: 5px; }
.tmc-col-2        { grid-column: span 2; }
.tmc-col-4        { grid-column: span 4; }
.tmc-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #1565C0;
    margin: 4px 0 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #E3F2FD;
}
.tmc-field label  { font-size: 13px; font-weight: 600; color: #333; }
.tmc-field label span { color: #e53935; }
.tmc-field input,
.tmc-field select {
    padding: 9px 12px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color .2s;
    background: #fafafa;
    width: 100%;
    box-sizing: border-box;
}
.tmc-field input:focus,
.tmc-field select:focus {
    outline: none;
    border-color: #1565C0;
    background: #fff;
}

/* ── Time slots ── */
.tmc-horarios {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}
.tmc-hora-btn {
    padding: 7px 13px;
    border: 1.5px solid #90CAF9;
    border-radius: 8px;
    background: #E3F2FD;
    color: #1565C0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.tmc-hora-btn:hover    { background: #1565C0; color: #fff; border-color: #1565C0; }
.tmc-hora-btn.selected { background: #1565C0; color: #fff; border-color: #1565C0; }
.tmc-hora-btn.ocupado  { background: #fce4e4; color: #b71c1c; border-color: #ef9a9a; cursor: not-allowed; text-decoration: line-through; }

/* ── Payment options ── */
.tmc-pago-opts {
    display: flex;
    gap: 12px;
}
.tmc-pago-opt {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s;
    font-size: 14px;
    font-weight: 600;
    color: #444;
}
.tmc-pago-opt:has(input:checked) {
    border-color: #1565C0;
    background: #E3F2FD;
    color: #1565C0;
}
.tmc-pago-opt input[type="radio"] { display: none; }
.tmc-pago-icon { font-size: 22px; }

/* ── Transfer info box ── */
.tmc-trans-box {
    background: #FFF8E1;
    border: 1.5px solid #FFE082;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.7;
}
.tmc-trans-box strong { color: #E65100; }

/* ── Messages ── */
.tmc-msg {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}
.tmc-msg.ok  { background: #E8F5E9; color: #2E7D32; border-left: 4px solid #4CAF50; }
.tmc-msg.err { background: #FFEBEE; color: #C62828; border-left: 4px solid #F44336; }

/* ── Submit ── */
.tmc-form-actions { margin-top: 20px; }
.tmc-btn-submit {
    width: 100%;
    padding: 14px;
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .15s;
}
.tmc-btn-submit:hover { background: #1da850; transform: translateY(-1px); }
.tmc-btn-submit:disabled { background: #aaa; cursor: not-allowed; transform: none; }

/* ── Utilities ── */
.tmc-hidden { display: none !important; }

/* ════════════════════════════
   RESPONSIVE – MÓVIL
════════════════════════════ */

/* Tablet y móvil grande */
@media (max-width: 600px) {
    #tmc-calendario-wrap {
        padding: 16px 10px 14px;
        border-radius: 12px;
        /* Evita desbordamiento horizontal */
        overflow: hidden;
    }
    .tmc-cal-grid { gap: 4px; }
    .tmc-dow > div {
        font-size: 11px;
        padding: 5px 0;
        border-radius: 4px;
    }
    .tmc-day {
        font-size: 13px;
        border-radius: 7px;
    }
    .tmc-mes-label { font-size: 17px; }
    .tmc-nav { width: 34px; height: 34px; font-size: 20px; border-radius: 8px; }
    .tmc-legend { font-size: 11px; gap: 6px 12px; margin-top: 12px; }
    .tmc-dot { width: 11px; height: 11px; }

    /* Modal */
    #tmc-modal-overlay { padding: 0; align-items: flex-end; }
    #tmc-modal {
        padding: 18px 14px 18px;
        border-radius: 16px 16px 0 0;
        max-height: 92vh;
        /* ensure title+X always visible at top */
        padding-top: 52px;
    }
    .tmc-modal-title {
        font-size: 17px;
        position: absolute;
        top: 14px;
        left: 14px;
        right: 52px;
        margin: 0;
        padding-right: 0;
    }
    .tmc-modal-close {
        top: 12px;
        right: 12px;
        width: 34px;
        height: 34px;
    }
    .tmc-form-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .tmc-col-4     { grid-column: span 2; }
    .tmc-col-2     { grid-column: span 2; }
    .tmc-section-title { grid-column: span 2; }
    .tmc-pago-opts { flex-direction: column; gap: 8px; }
    .tmc-pago-opt  { padding: 10px 14px; font-size: 13px; }
}

/* Móvil pequeño */
@media (max-width: 400px) {
    #tmc-calendario-wrap { padding: 12px 8px 12px; }
    .tmc-cal-grid { gap: 3px; }
    .tmc-dow > div {
        font-size: 10px;
        padding: 4px 0;
    }
    .tmc-day { font-size: 12px; border-radius: 6px; }
    .tmc-mes-label { font-size: 15px; }
    .tmc-nav { width: 30px; height: 30px; font-size: 18px; }

    /* Modal ocupa toda la pantalla */
    #tmc-modal-overlay { padding: 0; align-items: flex-end; }
    #tmc-modal {
        padding: 52px 12px 16px;
        border-radius: 14px 14px 0 0;
        max-height: 98vh;
    }
    .tmc-form-grid { grid-template-columns: 1fr; gap: 10px; }
    .tmc-col-2, .tmc-col-4 { grid-column: span 1; }
    .tmc-section-title { grid-column: span 1; }
    .tmc-field input,
    .tmc-field select { font-size: 16px; } /* evita zoom en iOS */
}
