/* ============================================================
   ROUTES OF PERÚ – Sistema de Gestión de Tours
   Diseño responsive · Colores del logo (morado + dorado)
   ============================================================ */

/* ---------- VARIABLES ---------- */
:root {
    --purple:     #5B2A6B;
    --purple-dk:  #3E1A4A;
    --purple-lt:  #E8DAEF;
    --gold:       #D4AF37;
    --gold-dk:    #B8941F;
    --gold-lt:    #F4E4B8;
    --gold-soft:  #FBF5E1;
    --white:      #FFFFFF;
    --grey-lt:    #F5F5F5;
    --grey:       #E0E0E0;
    --grey-md:    #9E9E9E;
    --grey-dk:    #424242;
    --text:       #2C2C2C;
    --success:    #1E8449;
    --success-lt: #D4EFDF;
    --danger:     #922B21;
    --danger-lt:  #F5B7B1;
    --warning:    #CA6F1E;
    --warning-lt: #FAD7A0;
    --info:       #2874A6;
    --info-lt:    #AED6F1;

    --shadow-sm:  0 2px 8px rgba(0,0,0,.08);
    --shadow-md:  0 4px 16px rgba(0,0,0,.12);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.16);
    --radius:     12px;
    --radius-sm:  8px;
    --radius-lg:  16px;

    --sidebar-w:  260px;
    --topbar-h:   62px;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote {
    margin: 0; padding: 0;
}
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--grey-lt);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ---------- LAYOUT PRINCIPAL ---------- */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--purple-dk) 0%, var(--purple) 100%);
    color: #fff;
    padding: 0;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform .3s ease;
    box-shadow: var(--shadow-md);
}
.sidebar-header {
    padding: 20px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(212,175,55,.3);
    background: rgba(0,0,0,.15);
}
.sidebar-logo {
    width: 74px; height: 74px;
    border-radius: 50%;
    background: #fff;
    padding: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
    margin: 0 auto 10px;
    display: block;
}
.sidebar-brand {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .5px;
}
.sidebar-subbrand {
    color: var(--gold);
    font-size: 11px;
    font-style: italic;
    margin-top: 2px;
}
.sidebar-menu {
    list-style: none;
    padding: 12px 0;
}
.sidebar-menu li {
    margin: 2px 8px;
}
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: #F0E6F5;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    text-decoration: none;
}
.sidebar-menu a:hover {
    background: rgba(212,175,55,.15);
    color: var(--gold);
    text-decoration: none;
    transform: translateX(3px);
}
.sidebar-menu a.active {
    background: var(--gold);
    color: var(--purple-dk);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(212,175,55,.4);
}
.sidebar-menu .menu-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-section {
    padding: 12px 20px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gold);
    font-weight: 700;
    opacity: .8;
}
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(212,175,55,.2);
    font-size: 11px;
    color: rgba(255,255,255,.6);
    text-align: center;
    margin-top: auto;
}

/* ========== TOPBAR ========== */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 500;
}
.topbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--purple);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 10px;
}
.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--purple-dk);
    flex: 1;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: var(--gold-soft);
    border-radius: 20px;
    font-size: 13px;
    color: var(--purple-dk);
    font-weight: 600;
}
.topbar-user-icon {
    width: 30px; height: 30px;
    background: var(--gold);
    color: var(--purple-dk);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.topbar-logout {
    background: none;
    border: 1px solid var(--purple);
    color: var(--purple);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
}
.topbar-logout:hover {
    background: var(--purple);
    color: #fff;
    text-decoration: none;
}

/* ========== MAIN CONTENT ========== */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.content {
    padding: 24px;
    flex: 1;
}

/* ========== PAGE HEADER ========== */
.page-header {
    background: #fff;
    padding: 22px 26px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    border-left: 6px solid var(--gold);
}
.page-header h1 {
    color: var(--purple-dk);
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    line-height: 1.2;
}
.page-header h1 .header-emoji {
    font-size: 26px;
}
.page-header .subtitle {
    color: var(--grey-md);
    font-size: 13px;
    margin-top: 4px;
}

/* ========== CARDS ========== */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 18px;
    border: 1px solid var(--grey);
}
.card-header {
    margin: -22px -22px 18px;
    padding: 16px 22px;
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dk) 100%);
    color: #fff;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========== KPI CARDS ========== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.kpi-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--gold);
    transition: transform .2s, box-shadow .2s;
    position: relative;
    overflow: hidden;
}
.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.kpi-card.purple  { border-left-color: var(--purple); }
.kpi-card.success { border-left-color: var(--success); }
.kpi-card.warning { border-left-color: var(--warning); }
.kpi-card.info    { border-left-color: var(--info); }
.kpi-card.danger  { border-left-color: var(--danger); }

.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--grey-md);
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--purple-dk);
    line-height: 1.1;
}
.kpi-sub {
    font-size: 12px;
    color: var(--grey-md);
    margin-top: 6px;
}

/* ========== BOTONES ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--purple);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
    line-height: 1.2;
    font-family: inherit;
}
.btn:hover {
    background: var(--purple-dk);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.btn-gold {
    background: var(--gold);
    color: var(--purple-dk);
    font-weight: 700;
}
.btn-gold:hover {
    background: var(--gold-dk);
    color: var(--purple-dk);
}
.btn-success { background: var(--success); }
.btn-success:hover { background: #145A32; }
.btn-danger  { background: var(--danger); }
.btn-danger:hover  { background: #641E16; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #A04F14; }
.btn-info    { background: var(--info); }
.btn-info:hover    { background: #1B4F72; }
.btn-outline {
    background: transparent;
    color: var(--purple);
    border: 2px solid var(--purple);
}
.btn-outline:hover {
    background: var(--purple);
    color: #fff;
}
.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: var(--radius);
}
.btn-xl {
    padding: 18px 36px;
    font-size: 18px;
    border-radius: var(--radius);
}
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}
.btn-block { width: 100%; }
.btn-icon { padding: 8px 10px; }

/* Botón enorme dorado destacado */
.btn-hero {
    display: block;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dk) 100%);
    color: var(--purple-dk);
    padding: 24px 20px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    transition: all .3s;
    margin-bottom: 22px;
    border: 3px solid var(--purple-dk);
}
.btn-hero:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    color: var(--purple-dk);
    text-decoration: none;
}

/* Grid de botones tipo tarjetas */
.btn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}
.btn-tile {
    background: #fff;
    padding: 22px 12px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
    text-decoration: none;
    transition: all .25s;
    border: 2px solid transparent;
    color: var(--purple-dk);
    display: block;
}
.btn-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--gold);
    text-decoration: none;
    color: var(--purple-dk);
}
.btn-tile-icon {
    font-size: 36px;
    margin-bottom: 8px;
    display: block;
}
.btn-tile-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ========== FORMULARIOS ========== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.form-grid-full { grid-column: 1 / -1; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--purple-dk);
    display: flex;
    align-items: center;
    gap: 4px;
}
.form-label .required { color: var(--danger); }

.form-control {
    padding: 11px 14px;
    border: 2px solid var(--grey);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: all .2s;
    width: 100%;
}
.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212,175,55,.15);
}
.form-control[readonly] {
    background: var(--gold-soft);
    color: var(--purple-dk);
    font-weight: 600;
}
select.form-control {
    cursor: pointer;
    background: #fff url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%235B2A6B'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 12px center;
    padding-right: 32px;
    appearance: none;
    -webkit-appearance: none;
}
textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-section {
    padding: 14px 18px;
    background: linear-gradient(90deg, var(--purple) 0%, var(--purple-dk) 100%);
    color: #fff;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    margin: 22px 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.form-section:first-child { margin-top: 0; }

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 20px;
    border-top: 2px dashed var(--gold);
    margin-top: 24px;
}

/* ========== TABLA ========== */
.table-wrap {
    overflow-x: auto;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 700px;
}
.table thead th {
    background: var(--purple-dk);
    color: #fff;
    padding: 12px 10px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    position: sticky;
    top: 0;
    white-space: nowrap;
}
.table tbody td {
    padding: 10px;
    border-bottom: 1px solid var(--grey);
    vertical-align: middle;
}
.table tbody tr:nth-child(even) { background: var(--gold-soft); }
.table tbody tr:hover { background: var(--purple-lt); }
.table .text-right { text-align: right; }
.table .text-center { text-align: center; }
.table .text-nowrap { white-space: nowrap; }
.table-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
}
.table-actions a {
    padding: 5px 8px;
    border-radius: 6px;
    background: var(--purple-lt);
    color: var(--purple-dk);
    font-size: 12px;
    text-decoration: none;
    transition: all .2s;
}
.table-actions a:hover {
    background: var(--gold);
    color: var(--purple-dk);
    text-decoration: none;
}

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}
.badge-success   { background: var(--success-lt); color: #0E5924; }
.badge-danger    { background: var(--danger-lt);  color: #641E16; }
.badge-warning   { background: var(--warning-lt); color: #78471E; }
.badge-info      { background: var(--info-lt);    color: #1B4F72; }
.badge-primary   { background: var(--purple-lt);  color: var(--purple-dk); }
.badge-secondary { background: var(--grey);       color: var(--grey-dk); }

/* ========== FLASH MESSAGES ========== */
.flash {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown .3s ease;
    border-left: 5px solid;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.flash-success { background: var(--success-lt); color: #0E5924; border-color: var(--success); }
.flash-danger  { background: var(--danger-lt);  color: #641E16; border-color: var(--danger); }
.flash-warning { background: var(--warning-lt); color: #78471E; border-color: var(--warning); }
.flash-info    { background: var(--info-lt);    color: #1B4F72; border-color: var(--info); }

/* ========== FILTROS ========== */
.filter-bar {
    background: #fff;
    padding: 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
    border-top: 4px solid var(--gold);
}
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
.filter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ========== LOGIN ========== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dk) 100%);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border-top: 6px solid var(--gold);
}
.login-logo {
    width: 130px; height: 130px;
    border-radius: 50%;
    background: #fff;
    padding: 6px;
    margin: 0 auto 16px;
    box-shadow: 0 6px 24px rgba(0,0,0,.15);
}
.login-title {
    color: var(--purple-dk);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}
.login-sub {
    color: var(--grey-md);
    font-size: 13px;
    margin-bottom: 24px;
    font-style: italic;
}

/* ========== ALERTAS lista ========== */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}
.alert-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.alert-item.warning { background: var(--warning-lt); color: #78471E; border-left: 4px solid var(--warning); }
.alert-item.danger  { background: var(--danger-lt);  color: #641E16; border-left: 4px solid var(--danger); }
.alert-item.info    { background: var(--info-lt);    color: #1B4F72; border-left: 4px solid var(--info); }
.alert-icon { font-size: 18px; flex-shrink: 0; }

/* ========== CALENDARIO ========== */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    background: var(--grey);
    padding: 4px;
    border-radius: var(--radius-sm);
}
.cal-day-header {
    background: var(--purple);
    color: #fff;
    text-align: center;
    padding: 8px 4px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
}
.cal-day {
    background: #fff;
    min-height: 90px;
    padding: 6px 8px;
    font-size: 12px;
    position: relative;
}
.cal-day.other-month { background: #FAFAFA; color: var(--grey-md); }
.cal-day.today { background: var(--gold-soft); border: 2px solid var(--gold); }
.cal-day-num {
    font-weight: 700;
    color: var(--purple-dk);
    font-size: 13px;
    margin-bottom: 4px;
}
.cal-event {
    background: var(--purple);
    color: #fff;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* ========== UTILIDADES ========== */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--grey-md); }
.text-purple { color: var(--purple-dk); }
.text-gold   { color: var(--gold-dk); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none; }
.overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
    display: none;
}
.overlay.active { display: block; }

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
    :root { --sidebar-w: 260px; }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main {
        margin-left: 0;
    }
    .topbar-toggle {
        display: block;
    }
}
@media (max-width: 640px) {
    .content { padding: 14px; }
    .page-header { padding: 16px; }
    .page-header h1 { font-size: 18px; }
    .page-header h1 .header-emoji { font-size: 22px; }
    .card { padding: 16px; }
    .kpi-card { padding: 16px; }
    .kpi-value { font-size: 22px; }
    .btn { padding: 9px 16px; font-size: 13px; }
    .btn-hero { font-size: 17px; padding: 20px 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 12px; }
    .topbar-title { font-size: 15px; }
    .topbar-user { padding: 4px 10px; font-size: 12px; }
    .topbar-user-icon { width: 26px; height: 26px; font-size: 12px; }
    .table { font-size: 12px; }
    .table thead th, .table tbody td { padding: 8px 6px; }
}

/* ========== PRINT (para PDFs/impresión) ========== */
@media print {
    .sidebar, .topbar, .btn, .filter-bar, .form-actions, .no-print { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    body { background: #fff !important; }
    .card, .table-wrap { box-shadow: none !important; border: 1px solid #ccc !important; }
}
