:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --accent: #f59e0b;
    --background: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --text-light: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --glass: rgba(255, 255, 255, 0.9);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Glassmorphism Card */
.card {
    background: var(--surface);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(37, 99, 235, 0.4);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Public Display Specifics */
.display-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    padding-bottom: 3.5rem;
    /* Space for marquee */
}

.top-bar {
    display: none;
    /* Not used/visible in current design but keeping for safety if needed later */
}

.clock {
    position: absolute;
    top: 2vh;
    left: 50%;
    transform: translateX(-50%);
    font-size: 5vh;
    font-weight: 700;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    width: 100%;
    text-align: center;
    z-index: 10;
}

.display-content {
    flex: 1;
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 2vw;
    padding: 2vw;
    height: 100%;
    max-height: 100vh;
}

.current-ticket {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 2vw;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    position: relative;
    overflow: hidden;
    padding-top: 6vh;
}

.current-ticket.priority {
    background: linear-gradient(135deg, #e11d48 0%, #9f1239 100%);
}

.current-ticket::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.ticket-number {
    font-size: 35vmin;
    font-weight: 900;
    line-height: 1;
    margin-top: 0;
    margin-bottom: 1vh;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.ticket-label {
    font-size: 4vh;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.ticket-counter {
    font-size: 7vh;
    font-weight: 700;
    margin-top: 2vh;
    background: rgba(255, 255, 255, 0.2);
    padding: 1vh 2vw;
    border-radius: 1.5vw;
    backdrop-filter: blur(10px);
    width: 90%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-type-label {
    font-size: 5vh;
    font-weight: 500;
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    line-height: 1.2;
}

.history-panel {
    background: var(--surface);
    border-radius: 2vw;
    padding: 1.5vw;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.history-panel h2 {
    font-size: 2.5vh;
    margin-bottom: 2vh !important;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1vh;
    overflow-y: auto;
    padding-right: 0.5vw;
    flex: 1;
}

.history-item {
    display: flex;
    justify-content: flex-start;
    gap: 1vw;
    align-items: center;
    padding: 1vh 1vw;
    background: var(--background);
    border-radius: 1vw;
    transition: transform 0.2s;
    color: var(--text);
    /* Default color */
}

.history-item.normal {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.history-item.priority {
    background: linear-gradient(135deg, #e11d48 0%, #9f1239 100%);
    color: white;
}

.history-number {
    font-size: 6vh;
    font-weight: 800;
    color: inherit;
    /* Inherit from parent for contrast */
    min-width: 30%;
}

.history-meta {
    text-align: left;
    overflow: hidden;
}

.history-counter {
    font-size: 2.2vh;
    color: inherit;
    /* Inherit for contrast */
    opacity: 0.9;
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-time {
    font-size: 1.8vh;
    color: inherit;
    /* Inherit for contrast */
    opacity: 0.8;
    margin-top: 0.2vh;
}

/* Marquee Footer */
.marquee-footer {
    background: var(--text);
    color: white;
    padding: 1vh 0;
    overflow: hidden;
    white-space: nowrap;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    height: 5vh;
    display: flex;
    align-items: center;
}

.marquee-content {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 20s linear infinite;
    font-size: 1.5rem;
    font-weight: 600;
}

@keyframes marquee {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-100%, 0);
    }
}

/* Login / Select Page Redesign */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.login-card {
    width: 100%;
    max-width: 800px;
    background: var(--surface);
    border-radius: 2rem;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

.counter-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    /* Enforce 5 columns */
    gap: 0.75rem;
    margin-top: 2rem;
}

.counter-btn {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border: 2px solid #e2e8f0;
    background: var(--surface);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-light);
}

.counter-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

.counter-btn.active {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
}

.counter-btn.active::after {
    content: 'Ocupado';
    font-size: 0.8rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Input Styling */
.input-group {
    margin-bottom: 2rem;
}

.input-field {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 1rem;
    font-size: 1.1rem;
    transition: all 0.2s;
    outline: none;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Animations */
@keyframes popIn {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-pop {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Admin Dashboard Styles */
.dashboard-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.control-card {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
}

.control-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.control-card.full-width {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .dashboard-controls {
        grid-template-columns: 1fr;
    }

    .display-content {
        grid-template-columns: 1fr;
        height: auto;
    }

    .ticket-number {
        font-size: 8rem;
    }

    .login-card {
        padding: 1.5rem;
        border-radius: 0;
        height: 100vh;
        max-width: none;
    }

    /* Responsive adjustments for mobile */
    .counter-grid {
        grid-template-columns: repeat(3, 1fr);
        /* 3 columns on mobile */
    }
}

@media (max-width: 480px) {
    .counter-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on very small screens */
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--text);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: all 0.3s;
    font-weight: 600;
    min-width: 250px;
    border-left: 5px solid var(--primary);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.info {
    border-left-color: var(--primary);
}

@keyframes toastIn {
    0% {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }

    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.toast.fade-out {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
}