/* ================================================
   iOS 26 Liquid Glass Design System
   Sistema de Tickets de Soporte
   ================================================ */

:root {
    --blue:    #0A84FF;
    --green:   #30D158;
    --red:     #FF453A;
    --orange:  #FF9F0A;
    --yellow:  #FFD60A;
    --purple:  #BF5AF2;
    --pink:    #FF375F;
    --teal:    #40C8E0;

    --bg:           #F2F2F7;
    --bg2:          #FFFFFF;
    --surface:      rgba(255,255,255,0.72);
    --surface2:     rgba(255,255,255,0.55);
    --surface-blur: blur(40px) saturate(180%);
    --border:       rgba(0,0,0,0.08);
    --border2:      rgba(255,255,255,0.6);

    --label:        #000000;
    --label2:       rgba(60,60,67,0.6);
    --label3:       rgba(60,60,67,0.3);
    --fill:         rgba(120,120,128,0.12);
    --fill2:        rgba(120,120,128,0.08);

    --radius-sm:  10px;
    --radius:     16px;
    --radius-lg:  22px;
    --radius-xl:  28px;

    --shadow:    0 4px 24px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08);

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
    --font-rounded: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Helvetica Neue", sans-serif;

    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease:   cubic-bezier(0.4, 0, 0.2, 1);
    --dur:    0.28s;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:       #000000;
        --bg2:      #1C1C1E;
        --surface:  rgba(28,28,30,0.85);
        --surface2: rgba(44,44,46,0.7);
        --border:   rgba(255,255,255,0.1);
        --border2:  rgba(255,255,255,0.15);
        --label:    #FFFFFF;
        --label2:   rgba(235,235,245,0.6);
        --label3:   rgba(235,235,245,0.3);
        --fill:     rgba(120,120,128,0.20);
        --fill2:    rgba(120,120,128,0.12);
        --shadow:   0 4px 24px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
        --shadow-lg:0 12px 48px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.25);
    }
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--label);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--label3); border-radius: 99px; }

/* ================================================
   LAYOUT
   ================================================ */
.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Nav Bar ---- */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: var(--surface);
    backdrop-filter: var(--surface-blur);
    -webkit-backdrop-filter: var(--surface-blur);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    height: 56px;
    display: flex; align-items: center; justify-content: space-between;
}
.navbar-title { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }
.navbar-logo  { display: flex; align-items: center; gap: 8px; }
.navbar-logo .logo-icon {
    width: 30px; height: 30px; border-radius: 8px;
    background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}

.main { flex: 1; padding: 20px; max-width: 900px; margin: 0 auto; width: 100%; }

/* ================================================
   GLASS CARD
   ================================================ */
.card {
    background: var(--surface);
    backdrop-filter: var(--surface-blur);
    -webkit-backdrop-filter: var(--surface-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.card-body   { padding: 20px; }
.card-header { padding: 16px 20px 0; display: flex; align-items: center; justify-content: space-between; }

/* ================================================
   BUTTONS
   ================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 11px 20px;
    font-family: var(--font); font-size: 15px; font-weight: 600;
    border: none; border-radius: var(--radius);
    cursor: pointer; outline: none;
    transition: all var(--dur) var(--spring);
    letter-spacing: -0.2px; text-decoration: none;
    white-space: nowrap; user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }

.btn-primary   { background: var(--blue);   color: #fff; }
.btn-success   { background: var(--green);  color: #fff; }
.btn-danger    { background: var(--red);    color: #fff; }
.btn-warning   { background: var(--orange); color: #fff; }
.btn-purple    { background: var(--purple); color: #fff; }
.btn-whatsapp  { background: #25D366;       color: #fff; }
.btn-secondary {
    background: var(--fill);
    color: var(--label);
    border: 1px solid var(--border);
}
.btn-glass {
    background: var(--surface2);
    backdrop-filter: blur(20px);
    color: var(--blue);
    border: 1px solid var(--border2);
}
.btn-sm  { padding: 7px 14px; font-size: 13px; border-radius: 10px; }
.btn-lg  { padding: 15px 28px; font-size: 17px; border-radius: var(--radius-xl); width: 100%; }
.btn-icon{ padding: 10px; border-radius: 50%; width: 40px; height: 40px; }

/* ================================================
   FORMS
   ================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--label2); margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: 0.4px;
}
.form-control {
    width: 100%; padding: 13px 16px;
    font-family: var(--font); font-size: 15px; color: var(--label);
    background: var(--fill2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all var(--dur) var(--ease);
    -webkit-appearance: none; appearance: none;
}
.form-control:focus {
    border-color: var(--blue);
    background: var(--bg2);
    box-shadow: 0 0 0 4px rgba(10,132,255,0.15);
}
.form-control::placeholder { color: var(--label3); }
textarea.form-control { resize: vertical; min-height: 100px; line-height: 1.5; }
select.form-control    { cursor: pointer; }

/* ---- Segmented Control ---- */
.seg-control {
    display: flex; gap: 4px;
    background: var(--fill);
    padding: 4px; border-radius: 12px;
}
.seg-option { display: none; }
.seg-label {
    flex: 1; text-align: center; padding: 8px 4px;
    font-size: 13px; font-weight: 600;
    border-radius: 9px; cursor: pointer;
    transition: all var(--dur) var(--ease);
    color: var(--label2);
}
.seg-option:checked + .seg-label {
    background: var(--bg2);
    color: var(--label);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.seg-option[value="baja"]:checked    + .seg-label { color: var(--green); }
.seg-option[value="media"]:checked   + .seg-label { color: var(--orange); }
.seg-option[value="alta"]:checked    + .seg-label { color: var(--red); }
.seg-option[value="critica"]:checked + .seg-label { color: var(--pink); }

/* ================================================
   BADGES / CHIPS
   ================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 99px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.2px;
    white-space: nowrap;
}
.badge-dot {
    width: 6px; height: 6px; border-radius: 50%; background: currentColor;
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* Status */
.badge-abierto    { background: rgba(10,132,255,0.15);  color: var(--blue); }
.badge-visto      { background: rgba(191,90,242,0.15);  color: var(--purple); }
.badge-en_proceso { background: rgba(255,159,10,0.15);  color: var(--orange); }
.badge-resuelto   { background: rgba(48,209,88,0.15);   color: var(--green); }
.badge-cerrado    { background: var(--fill);             color: var(--label2); }

/* Priority */
.badge-baja    { background: rgba(48,209,88,0.15);  color: var(--green); }
.badge-media   { background: rgba(255,159,10,0.15); color: var(--orange); }
.badge-alta    { background: rgba(255,69,58,0.15);  color: var(--red); }
.badge-critica { background: rgba(255,55,95,0.2);   color: var(--pink); }

/* ================================================
   TICKET CARD LIST
   ================================================ */
.ticket-list { display: flex; flex-direction: column; gap: 12px; }
.ticket-card { display: block; text-decoration: none; color: inherit; cursor: pointer; }
.ticket-card .card-body { padding: 16px 20px; }
.ticket-card-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; margin-bottom: 8px;
}
.ticket-folio  { font-size: 12px; font-weight: 600; color: var(--label2); letter-spacing: 0.3px; margin-bottom: 3px; }
.ticket-title  { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
.ticket-meta   { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ticket-reporter { font-size: 13px; color: var(--label2); display: flex; align-items: center; gap: 4px; }
.ticket-time   { font-size: 12px; color: var(--label3); margin-left: auto; }

/* Priority left strip */
.ticket-card { position: relative; overflow: hidden; }
.ticket-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.ticket-card.priority-baja::before    { background: var(--green); }
.ticket-card.priority-media::before   { background: var(--orange); }
.ticket-card.priority-alta::before    { background: var(--red); }
.ticket-card.priority-critica::before { background: var(--pink); animation: glow-strip 1.5s ease-in-out infinite; }
@keyframes glow-strip { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ================================================
   STATS GRID
   ================================================ */
.stats-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 10px; margin-bottom: 20px;
}
@media(min-width:600px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
    background: var(--surface);
    backdrop-filter: var(--surface-blur);
    -webkit-backdrop-filter: var(--surface-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.stat-label { font-size: 13px; color: var(--label2); margin-top: 4px; font-weight: 500; }
.stat-blue   .stat-value { color: var(--blue); }
.stat-orange .stat-value { color: var(--orange); }
.stat-green  .stat-value { color: var(--green); }
.stat-red    .stat-value { color: var(--red); }

/* ================================================
   TABS
   ================================================ */
.tab-bar {
    display: flex; gap: 4px; overflow-x: auto;
    padding: 4px; background: var(--fill);
    border-radius: var(--radius); margin-bottom: 16px;
    scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
    flex: 0 0 auto; padding: 7px 14px;
    font-size: 14px; font-weight: 600; border-radius: 10px;
    border: none; background: transparent; cursor: pointer;
    color: var(--label2); font-family: var(--font);
    transition: all var(--dur) var(--ease);
    white-space: nowrap;
}
.tab-btn.active {
    background: var(--bg2); color: var(--label);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ================================================
   MODAL / BOTTOM SHEET
   ================================================ */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 16px;
    opacity: 0; pointer-events: none;
    transition: opacity var(--dur) var(--ease);
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal-sheet {
    background: var(--bg2);
    border-radius: var(--radius-xl) var(--radius-xl) var(--radius-lg) var(--radius-lg);
    width: 100%; max-width: 560px; max-height: 92vh;
    overflow-y: auto; overflow-x: hidden;
    box-shadow: var(--shadow-lg);
    transform: translateY(40px);
    transition: transform var(--dur) var(--spring);
}
.modal-backdrop.open .modal-sheet { transform: translateY(0); }

.sheet-handle {
    width: 36px; height: 4px; background: var(--label3);
    border-radius: 99px; margin: 10px auto 0;
}
.sheet-header {
    padding: 12px 20px 0;
    display: flex; align-items: center; justify-content: space-between;
}
.sheet-title { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.sheet-body  { padding: 20px; }

/* ================================================
   SIGNATURE PAD
   ================================================ */
.sig-pad-wrap {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg2);
    position: relative;
    touch-action: none;
}
.sig-pad-wrap canvas { display: block; width: 100%; height: 160px; cursor: crosshair; }
.sig-pad-hint {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    color: var(--label3); font-size: 14px; pointer-events: none;
    transition: opacity 0.2s;
}
.sig-pad-wrap.signed .sig-pad-hint { opacity: 0; }
.sig-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }

/* ================================================
   UPLOAD ZONE
   ================================================ */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px; text-align: center;
    cursor: pointer; transition: all var(--dur) var(--ease);
    background: var(--fill2);
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--blue);
    background: rgba(10,132,255,0.06);
}
.upload-zone input { display: none; }
.upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-text { font-size: 15px; font-weight: 600; color: var(--blue); }
.upload-hint { font-size: 12px; color: var(--label3); margin-top: 4px; }

.file-preview-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.file-preview {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--fill); border-radius: var(--radius-sm);
    font-size: 14px;
}
.file-preview-name   { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-size   { color: var(--label2); font-size: 12px; flex-shrink: 0; }
.file-preview-remove { cursor: pointer; color: var(--red); padding: 2px; font-size: 16px; }

/* ================================================
   IMAGE GALLERY
   ================================================ */
.img-gallery { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.img-thumb {
    width: 80px; height: 80px; object-fit: cover;
    border-radius: 10px; border: 1px solid var(--border);
    cursor: pointer; transition: transform var(--dur) var(--spring);
}
.img-thumb:hover { transform: scale(1.05); }

/* ================================================
   TOAST
   ================================================ */
#toast-container {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
    pointer-events: none;
}
.toast {
    background: rgba(50,50,52,0.95);
    backdrop-filter: blur(20px);
    color: #fff;
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 14px; font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    animation: toast-in 0.3s var(--spring) forwards;
    max-width: 320px; text-align: center;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
@keyframes toast-in  { from{opacity:0;transform:translateY(16px) scale(0.9)} to{opacity:1;transform:none} }
@keyframes toast-out { to{opacity:0;transform:translateY(16px) scale(0.9)} }

/* ================================================
   EMPTY STATE
   ================================================ */
.empty-state {
    display: flex; flex-direction: column; align-items: center;
    padding: 48px 20px; text-align: center; gap: 12px;
}
.empty-icon  { font-size: 56px; opacity: 0.3; }
.empty-title { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.empty-sub   { font-size: 15px; color: var(--label2); }

/* ================================================
   DETAIL VIEW
   ================================================ */
.detail-section       { margin-bottom: 20px; }
.detail-section-title {
    font-size: 13px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--label2); margin-bottom: 10px;
}
.detail-row {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px;
}
.detail-row:last-child { border-bottom: none; }
.detail-key { font-size: 14px; color: var(--label2); flex-shrink: 0; }
.detail-val { font-size: 14px; font-weight: 500; text-align: right; }

/* Timeline */
.timeline { padding-left: 16px; border-left: 2px solid var(--border); }
.timeline-item { position: relative; padding: 0 0 16px 16px; font-size: 14px; }
.timeline-item::before {
    content: '';
    position: absolute; left: -6px; top: 4px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--blue);
    border: 2px solid var(--bg2);
}
.timeline-action { font-weight: 600; margin-bottom: 2px; }
.timeline-desc   { color: var(--label2); }
.timeline-time   { font-size: 12px; color: var(--label3); margin-top: 2px; }

/* ================================================
   LINK PAGES (view / signoff)
   ================================================ */
.link-page {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding: 24px 16px 40px;
    background: var(--bg);
}
.link-page .card { width: 100%; max-width: 540px; }

.folio-big {
    font-size: 13px; font-weight: 700; color: var(--blue);
    letter-spacing: 1px; text-transform: uppercase;
    background: rgba(10,132,255,0.1); padding: 4px 12px;
    border-radius: 99px; display: inline-block; margin-bottom: 6px;
}

/* ================================================
   LOADING
   ================================================ */
.spinner {
    width: 24px; height: 24px; border: 3px solid var(--fill);
    border-top-color: var(--blue); border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.page-loader { display: flex; align-items: center; justify-content: center; min-height: 200px; }

/* ================================================
   LINK SHARE BOX
   ================================================ */
.link-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--fill); border-radius: var(--radius);
    padding: 12px 14px; border: 1px solid var(--border);
}
.link-url {
    flex: 1; font-size: 13px; color: var(--blue);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    word-break: break-all;
}

/* ================================================
   SUCCESS / DONE
   ================================================ */
.success-icon {
    width: 72px; height: 72px; border-radius: 50%;
    background: rgba(48,209,88,0.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; margin: 0 auto 16px;
    animation: pop-in 0.5s var(--spring);
}
@keyframes pop-in { from{transform:scale(0)} to{transform:scale(1)} }

/* FAB */
.fab {
    position: fixed; bottom: 28px; right: 20px; z-index: 50;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--blue);
    box-shadow: 0 8px 28px rgba(10,132,255,0.4);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border: none; font-size: 28px; color: #fff;
    transition: all var(--dur) var(--spring);
    -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: scale(0.92); }

/* ================================================
   RESPONSIVE
   ================================================ */
@media(max-width: 600px) {
    .main       { padding: 12px; }
    .card-body  { padding: 14px; }
    .sheet-body { padding: 14px; }
    .btn-lg     { padding: 14px 20px; font-size: 16px; }
}

/* ================================================
   UTILITIES
   ================================================ */
.flex             { display: flex; }
.flex-col         { flex-direction: column; }
.items-center     { align-items: center; }
.justify-between  { justify-content: space-between; }
.gap-8            { gap: 8px; }
.gap-12           { gap: 12px; }
.mt-4             { margin-top: 4px; }
.mt-8             { margin-top: 8px; }
.mt-12            { margin-top: 12px; }
.mt-20            { margin-top: 20px; }
.mb-8             { margin-bottom: 8px; }
.mb-12            { margin-bottom: 12px; }
.mb-16            { margin-bottom: 16px; }
.text-sm          { font-size: 13px; }
.text-xs          { font-size: 12px; }
.text-muted       { color: var(--label2); }
.text-center      { text-align: center; }
.font-bold        { font-weight: 700; }
.hidden           { display: none !important; }
.w-full           { width: 100%; }
.divider          { height: 1px; background: var(--border); margin: 16px 0; }
