/* Configuración General */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4e54c8;
    --primary-gradient: linear-gradient(135deg, #4e54c8, #8f94fb);
    --secondary: #ff7e5f;
    --secondary-gradient: linear-gradient(135deg, #ff7e5f, #feb47b);
    --success: #00b09b;
    --success-gradient: linear-gradient(135deg, #00b09b, #96c93d);
    --warning: #f1c40f;
    --warning-gradient: linear-gradient(135deg, #f1c40f, #f39c12);
    --danger: #ff416c;
    --danger-gradient: linear-gradient(135deg, #ff416c, #ff4b2b);
    --bg-body: #f4f7f6;
    --bg-card: #ffffff;
    --text-main: #2d3436;
    --text-light: #636e72;
    --border: #dfe6e9;
    --shadow-soft: 0 10px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 15px 30px rgba(0, 0, 0, 0.1);
    --radius: 16px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background-color: #dcdde1;
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary);
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
}

.search-bar {
    background: #f1f2f6;
    padding: 10px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    width: 250px;
    transition: 0.3s ease;
    border: 1px solid transparent;
}

.search-bar:focus-within {
    width: 320px;
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(78, 84, 200, 0.1);
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    margin-left: 10px;
    width: 100%;
    color: var(--text-main);
    font-family: inherit;
}

.search-bar i {
    color: var(--text-light);
}

.brand {
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    line-height: 1.2;
}

.brand i {
    font-size: 2rem;
    margin-bottom: 5px;
    background: -webkit-linear-gradient(45deg, #4e54c8, #8f94fb);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text h1 {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-text p {
    font-size: 0.7rem;
    color: var(--text-light);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 600;
    margin: 0;
}

.header-actions {
    justify-self: end;
    display: flex;
    gap: 12px;
}

.btn-outline {
    border: 2px solid var(--border);
    background: white;
    color: var(--text-light);
    border-radius: 12px;
    width: 42px;
    height: 42px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 1.1rem;
}

.btn-outline:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}

/* Layout Principal */
.container {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 25px;
    padding: 30px;
    flex: 1;
    overflow: hidden;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.main-panel {
    display: flex;
    flex-direction: column;
    gap: 25px;
    overflow-y: auto;
    padding-right: 5px;
    padding-top: 5px;
    scrollbar-width: thin;
}

/* Tarjetas y Estadísticas */
.stats-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-soft);
    border: 1px solid white;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 1;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.action-card {
    cursor: pointer;
    background: var(--primary-gradient);
    color: white;
    justify-content: center;
    border: none;
}

.action-card .icon-box {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.action-card strong,
.action-card span {
    color: white !important;
}

.action-card:hover {
    transform: scale(1.02);
}

.icon-box {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.4rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.green {
    background: var(--success-gradient);
}

.blue {
    background: var(--secondary-gradient);
}

.orange {
    background: var(--warning-gradient);
}

.stat-card strong {
    display: block;
    font-size: 1.5rem;
    color: var(--text-main);
    font-weight: 700;
}

.stat-card span {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Calendario */
.calendar-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow-soft);
}

.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f8f9fa;
    padding: 5px 15px;
    border-radius: 30px;
}

.month-nav h2 {
    margin: 0;
    font-size: 1.1rem;
    min-width: 150px;
    text-align: center;
    color: var(--text-main);
    font-weight: 600;
}

.btn-nav {
    border: none;
    background: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: 0.2s;
}

.btn-nav:hover {
    background: var(--primary);
    color: white;
}

.filter-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-box select {
    padding: 8px 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
    color: var(--text-main);
    outline: none;
    background: white;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.day {
    min-height: 130px;
    border: 1px solid #f1f2f6;
    border-radius: 12px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 4px;
    transition: 0.2s;
}

.day:hover {
    border-color: #d1ccc0;
    transform: scale(1.01);
    z-index: 5;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.day-number {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 4px;
    padding-left: 5px;
}

.today {
    background: #fffcf0;
    border: 2px solid #ffd32a;
}

.today .day-number {
    background: #ffd32a;
    color: #333;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Barras de Reserva */
.booking-slot {
    height: 22px;
    margin-bottom: 3px;
    width: 100%;
    display: flex;
    align-items: center;
}

.booking-placeholder {
    width: 100%;
    height: 100%;
}

.booking-bar {
    font-size: 0.7rem;
    color: white;
    padding: 0 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 6px;
    width: 100%;
    height: 100%;
    line-height: 22px;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    font-weight: 500;
}

.icon-in,
.icon-out {
    font-size: 0.8em;
    opacity: 0.95;
}

.icon-out {
    margin-left: auto;
}

.bar-start {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    margin-right: -4px;
    z-index: 3;
}

.bar-mid {
    border-radius: 0;
    margin-left: -4px;
    margin-right: -4px;
    z-index: 2;
}

.bar-end {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -4px;
    z-index: 3;
}

.bar-single {
    border-radius: 6px;
    margin: 0 1px;
}

.bg-paid {
    background: var(--success-gradient);
}

.bg-deposit {
    background: var(--warning-gradient);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.bg-pending {
    background: #b2bec3;
}

.double-bar-container {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 2px;
}

.half-bar {
    flex: 1;
    font-size: 0.65rem;
    color: white;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    display: flex;
    align-items: center;
    padding: 0 4px;
    position: relative;
    line-height: 22px;
    font-weight: 500;
}

.half-left {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    justify-content: flex-start;
    border-radius: 6px 0 0 6px;
}

.half-right {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    justify-content: flex-end;
    border-radius: 0 6px 6px 0;
}

/* Panel Derecho y Notas */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 25px;
    height: 100%;
    overflow-y: auto;
}

.notes-section {
    background: #fff9c4;
    background-image: linear-gradient(#fcf6c9 .1em, transparent .1em);
    background-size: 100% 1.5em;
    padding: 15px;
    border-radius: var(--radius);
    height: 350px;
    flex: none;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-soft);
    border: 1px solid #f0e68c;
    position: relative;
}

.notes-section h3 {
    margin-top: 0;
    color: #a69837;
    font-size: 0.9rem;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.7);
    padding: 5px;
    border-radius: 5px;
    display: inline-block;
}

textarea {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    resize: none;
    outline: none;
    line-height: 1.5em;
    color: #5c521a;
}

.mini-legend {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.mini-legend h4 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: var(--text-main);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-light);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.paid {
    background: var(--success-gradient);
}

.dot.deposit {
    background: var(--warning-gradient);
}

.dot.pending {
    background: #b2bec3;
}

.booking-list-item {
    background: white;
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 12px;
    border-left: 5px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: 0.2s;
}

.booking-list-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(45, 52, 54, 0.6);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    width: 480px;
    max-width: 90%;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--bg-body);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: 700;
}

.close-btn {
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-light);
    transition: 0.2s;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:hover {
    background: #f1f2f6;
    color: var(--danger);
}

.form-body {
    padding: 30px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
}

.icon-input {
    position: relative;
}

.icon-input i {
    position: absolute;
    left: 15px;
    top: 14px;
    color: var(--primary);
    font-size: 1rem;
}

.icon-input input {
    padding-left: 45px;
}

input,
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #f1f2f6;
    border-radius: 12px;
    box-sizing: border-box;
    outline: none;
    transition: 0.3s;
    font-size: 0.95rem;
    color: var(--text-main);
    font-family: inherit;
    background: #f9f9f9;
}

input:focus,
select:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(78, 84, 200, 0.1);
}

.total-preview {
    text-align: right;
    font-weight: 800;
    color: var(--primary);
    font-size: 1.4rem;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px dashed var(--border);
}

.modal-footer {
    padding: 20px 30px;
    background: #f9f9f9;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border);
}

.btn {
    border: none;
    padding: 12px 25px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-save {
    background: var(--primary-gradient);
    color: white;
}

.btn-save:hover {
    box-shadow: 0 8px 15px rgba(78, 84, 200, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-light);
    margin-right: 10px;
}

.btn-secondary:hover {
    background: #f1f2f6;
}

.btn-cancel {
    background: #ffeaa7;
    color: #d63031;
}

/* Responsive */
@media (max-width: 768px) {

    html,
    body {
        height: auto !important;
        min-height: 100vh;
        overflow-y: scroll !important;
        overflow-x: hidden;
        position: static !important;
    }

    .container {
        display: flex;
        flex-direction: column;
        padding: 10px;
        gap: 15px;
        height: auto !important;
        overflow: visible !important;
    }

    .main-panel,
    .side-panel {
        padding-right: 0;
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    header {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        gap: 10px;
        height: auto;
        box-shadow: none;
        border-bottom: 1px solid #eee;
    }

    .brand {
        order: 1;
        width: auto;
        flex-direction: row;
        margin: 0;
        gap: 8px;
    }

    .brand i {
        font-size: 1.4rem;
        margin: 0;
    }

    .brand-text h1 {
        font-size: 1rem;
    }

    .brand-text p {
        display: none;
    }

    .header-actions {
        order: 2;
        width: auto;
        gap: 8px;
    }

    .header-actions .btn-outline {
        width: 35px;
        height: 35px;
        font-size: 1rem;
        flex: none;
    }

    .search-bar {
        order: 3;
        width: 100%;
        margin-top: 5px;
        padding: 8px 15px;
        height: 40px;
        background-color: #f5f5f5;
    }

    .stat-card,
    .calendar-section,
    .notes-section,
    .booking-list-item {
        box-shadow: none !important;
        border: 1px solid #eee;
    }

    .modal {
        background-color: #ffffff;
        z-index: 9999;
        align-items: flex-start;
        padding: 0;
    }

    .modal-content {
        box-shadow: none;
        border: none;
        border-radius: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 20px;
        overflow-y: auto;
        max-width: none;
    }

    .close-btn {
        background: #f1f2f6;
        width: 40px;
        height: 40px;
    }

    .modal-footer {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 20px 15px;
        padding-bottom: 30px;
    }

    .modal-footer>div:not(#btnDeleteModal) {
        display: flex;
        width: 100%;
        gap: 12px;
        order: 1;
    }

    .modal-footer .btn-secondary,
    .modal-footer .btn-save {
        flex: 1;
        width: 50%;
        margin: 0 !important;
    }

    #btnDeleteModal {
        width: 100%;
        order: 2;
        margin: 0 0 10px 0 !important;
        background-color: #ffebee !important;
        color: #d63031 !important;
        border: 1px solid #ff7675 !important;
    }

    .modal-footer button {
        height: 55px !important;
        font-size: 1rem;
        border-radius: 12px;
    }

    .calendar-section {
        overflow-x: auto;
    }

    .weekdays,
    .days {
        min-width: 600px;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .form-body {
        padding: 15px;
    }

    div:where(.swal2-container) div:where(.swal2-popup) {
        padding: 10px !important;
        width: 90% !important;
        max-width: 350px !important;
    }
}

div:where(.swal2-container) {
    z-index: 10000 !important;
}