

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: #f0f0f1;
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: none;
    position: relative;
    width: 100%;
    max-width: 100vw;
}



::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #979797;
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #1e3a8a 100%, #a855f7 100%);
}

::-webkit-scrollbar-corner {
    background: #f1f1f1;
}

/* Firefox scrollbar styling - targeted to avoid overriding WebKit styles in Chrome */
@supports (-moz-appearance: none) {
    * {
        scrollbar-width: thin;
        scrollbar-color: #979797 #f1f1f1;
    }
}



/* ✅ Móvil */
@media (max-width: 768px) {
    .main-wrapper {
        padding: 24px 12px 24px 12px;
        min-height: calc(100dvh - 64px);
        height: calc(100dvh - 64px);
        align-items: center;
        overflow: hidden;
    }
    
    .container {
        max-height: calc(100dvh - 64px - 48px);
        padding: 20px;
        overflow: auto;
    }
}

/* Main wrapper fills the remaining viewport (under the top bar) and centers the .container */
.main-wrapper {
    min-height: calc(100vh - 64px);
    height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    padding: 32px 20px 32px 20px;
    overflow: hidden;
    position: relative;
    top: 64px;
}

.container {
    max-width: 600px;
    width: 100%;
    background: white;
    padding: 50px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    height: auto;
    max-height: calc(100vh - 64px - 64px);
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

#authSection{
    width: 100%;
}

#ticketsSection {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-self: flex-start; 
    scroll-margin-top: 0;  
}  



h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}
.cif-card {
    background: linear-gradient(180deg, #fbfbff 0%, #f4f6ff 100%);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 22px;
    border-left: 8px solid #667eea;
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.08);
}

.ticket-row {
    background: transparent;
    border: none;
    padding: 10px 8px;
    margin: 6px 0;
}

.ticket-row + .ticket-row {
    border-top: 1px dashed rgba(0,0,0,0.06);
}

.ticket-row .ticket-info {
    background: transparent;
    box-shadow: none;
    padding: 0;
}

/* Simple header + row styles for compact ticket list */
.cif-header-simple {
    background: linear-gradient(90deg, #1e3a8a 100%, #a855f7 100%);
    color: #fff;
    padding: 14px 16px;
    margin: 6px 0 14px 0;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(118,75,162,0.12);
    user-select: none;
    transition: background 0.2s ease, transform 0.1s ease;
}

.cif-header-simple:hover {
    background: linear-gradient(90deg, #2547a8 100%, #b66dd1 100%);
    transform: translateY(-1px);
}

.cif-header-simple:active {
    transform: translateY(0px);
}

.cif-tickets-container {
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.cif-arrow {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 12px;
}

.ticket-row-simple {
    background: #f0f0f1;
    border: 1px solid #e0e0e0;
    padding: 12px 14px;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(16,24,40,0.04);
    transition: transform 0.16s, box-shadow 0.16s, background 0.16s;
}

.ticket-row-simple div {
    margin: 4px 0;
    color: #333;
}

.ticket-row-simple a {
    color: #2b6cb0;
    text-decoration: none;
}

.ticket-row-simple a:hover {
    text-decoration: underline;
}

section {
    margin-bottom: 20px;
    padding: 20px;
    border: none;
    border-radius: 8px;
    /*background: #f9f9f9;*/
}

h2 {
    color: #555;
    margin-bottom: 15px;
}

input {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

input:focus {
    outline: none;
    border-color: #667eea;
}

button {
    margin: 10px 5px;
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    background: linear-gradient(135deg, #1e3a8a 100%, #a855f7 100%);
    color: white;
    border: none;
    border-radius: 6px;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

button:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#status {
    margin-top: 20px;
    font-size: 14px;
    color: #d32f2f;
    text-align: center;
    border: 1px solid black;
    border-radius: 7px;
    padding: 12px;
}

#ticketsList {
    margin-top: 20px;
    text-align: left;
}

#ticketsList .legacy-ticket {
    background: #f0f0f0;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 6px;
}

#ticketsList a {
    color: #667eea;
    text-decoration: none;
}

#ticketsList a:hover {
    text-decoration: underline;
}

/* Header area for tickets (title + logout) */
.tickets-top {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.user-menu-wrapper {
    position: relative;
}

.user-icon-btn {
    background: linear-gradient(90deg, #1e3a8a 100%, #a855f7 100%);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102,126,234,0.18);
}

.user-icon-btn svg { filter: drop-shadow(0 1px 0 rgba(0,0,0,0.06)); }

.user-menu {
    position: absolute;
    right: 0;
    top: 52px;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(16,24,40,0.08);
    z-index: 2000;
    padding: 6px;
}

/* Global user fixed in top-right corner outside main container */
.top-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4000;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px 18px;
    height: 64px;
}

.global-user {
    position: relative; /* positioned inside the top container */
    z-index: 4100;
    display: inline-flex;
    align-items: center;
    /*gap: 10px;
    background: rgba(255,255,255,0.98);
    padding: 6px 10px;
    border-radius: 12px;
    border: 1px solid rgba(16,24,40,0.06);
    box-shadow: 0 6px 20px rgba(16,24,40,0.06);*/
}

/* Defensive: ensure [hidden] actually hides the element */
.global-user[hidden], .global-user[aria-hidden="true"] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Logo placed at the left side of the top container. Keep it within bar height */
.top-logo {
    display: block;
    height: 34px; /* fits inside the bar without enlarging it */
    max-height: 34px;
    width: auto;
    margin-left: 6px;
    object-fit: contain;
}
.user-dni {
    font-weight: 600;
    color: #222;
    /*background: rgba(255,255,255,0.9);*/
    padding: 6px 10px;
    /*border-radius: 8px;*/
    /*box-shadow: 0 4px 12px rgba(16,24,40,0.06);*/
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #222;
    border-radius: 8px;
}

.user-menu-item:hover { background: #f4f6ff; }

.user-menu-item.danger { color: #c62828; }

.user-menu-item.danger:hover { background: rgba(198,40,40,0.06); }

/* Estilos para tickets organizados por CIF */
.cif-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    margin: 20px 0 10px 0;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.cif-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ticket-count {
    font-size: 14px;
    font-weight: 400;
    opacity: 0.9;
}

.cif-tickets {
    margin-bottom: 30px;
}

.ticket-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Alternate shading for ticket rows inside a CIF group */
.cif-card .ticket-row-simple:nth-child(odd) {
    background: #fbfbff;
}

.cif-card .ticket-row-simple:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(102,126,234,0.12);
    background: #ffffff;
}

/* Make ticket info text clearer and slightly larger */
.ticket-row-simple .ticket-info {
    color: #222;
    line-height: 1.5;
    font-size: 15px;
}

/* Small accent dot to visually separate tickets */
/* Removed purple dot as per user preference */

.ticket-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.ticket-info {
    line-height: 1.6;
    color: #333;
}

.ticket-info strong {
    color: #555;
    font-weight: 600;
}

.ticket-info a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.ticket-info a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .container {
        /*padding: 20px;
        height: 85%;*/
    }
    button {
        width: 100%;
        margin: 10px 0;
    }
    
    .cif-header h3 {
        font-size: 16px;
    }
}

.status-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 9000;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.status-modal[hidden] { 
    display: none; 
}

.status-modal.show {
    opacity: 1;
    pointer-events: auto;
}


/* Loading modal centered on screen */
.status-modal-box.loading,
.status-modal-box.centered {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(69,90,100,0.95);
    border-left: 4px solid #455a64;
}

.status-modal-box {
    pointer-events: auto;
    background: rgba(50,50,50,0.95);
    color: #fff;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 280px;
    max-width: 90vw;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Status types with colors */
.status-modal-box.error {
    background: rgba(211,47,47,0.95);
    border-left: 4px solid #c62828;
}

.status-modal-box.success {
    background: rgba(46,125,50,0.95);
    border-left: 4px solid #2e7d32;
}

.status-modal-box.info {
    background: rgba(25,118,210,0.95);
    border-left: 4px solid #1565c0;
}

/* Edit Profile Modal styles */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    z-index: 6000;
    padding: 20px;
}

.modal[hidden] { display: none; }

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    max-width: 450px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 25px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
}

/* Current email display */
#currentEmailDisplay {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f2ff 100%);
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    font-size: 15px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

#currentEmailDisplay strong {
    color: #2d3748;
    font-weight: 600;
}

/* Form sections */
.modal-content .form-section {
    margin-bottom: 25px;
}

.modal-content .form-section h4 {
    margin: 0 0 15px 0;
    color: #4a5568;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

.modal-content label {
    display: block;
    margin: 12px 0 6px 0;
    font-weight: 500;
    color: #2d3748;
    font-size: 14px;
}

.modal-content input {
    display: block;
    width: 100%;
    margin: 0 0 15px 0;
    padding: 12px 44px 12px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    box-sizing: border-box;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 15px;
}

.modal-content input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: #ffffff;
}

.modal-content input::placeholder {
    color: #a0aec0;
}

.password-container {
    position: relative;
    margin-bottom: 5px;
    min-height: 48px;
} 




.eye-btn {
    position: absolute;
    right: 10px;
    top: 4px;
    transform: none !important;
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    margin: 0;
    color: #718096;
    flex-shrink: 0;
    transition: color 0.2s ease, background-color 0.2s ease;
    box-shadow: none !important;
}

.eye-btn:hover {
    color: #2d3748;
    background-color: #f7fafc;
}

.eye-btn:focus {
    outline: 2px solid rgba(102, 126, 234, 0.3);
    color: #2d3748;
}

.field-info {
    margin-top: -10px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.hint {
    font-size: 14px;
}

.email-container {
    position: relative;
    margin-bottom: 15px;
    min-height: 48px;
}

.edit-btn {
    position: absolute;
    right: 10px;
    top: 4px;
    transform: none !important;
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    margin: 0;
    color: #718096;
    flex-shrink: 0;
    transition: color 0.2s ease, background-color 0.2s ease;
    box-shadow: none !important;
}

.edit-btn:hover {
    color: #2d3748;
    background-color: #f7fafc;
}

.edit-btn:focus {
    outline: 2px solid rgba(102, 126, 234, 0.3);
    color: #2d3748;
}

.eye-btn svg {
    display: block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.modal-content hr {
    margin: 25px 0;
    border: none;
    /*border-top: 1px solid #e2e8f0;*/
}

.modal-content .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

#saveProfileBtn {
    background: linear-gradient(90deg, #1e3a8a 100%, #a855f7 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#saveProfileBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

#cancelProfileBtn {
    background: transparent;
    color: #4a5568;
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

#cancelProfileBtn:hover {
    background-color: #f7fafc;
    border-color: #cbd5e0;
}