/* QRSync Blazor Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    color: #333;
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
    font-size: 12px;
    margin-top: 4px;
}

/* Layout */
.app-container {
    width: 100%;
    height: 100vh;   /* fallback — navegadores sin soporte para dvh */
    height: 100dvh;  /* alto real de viewport visible, evita el gap con barras de navegador dinámicas (mobile) o escalado de DPI (notebooks) */
}

.app-layout {
    display: flex;
    height: 100%;
}

.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    padding: 20px;
    overflow-y: auto;   /* con muchos ítems de menú (rol Admin/Supervisor) el contenido
                            supera el alto de la caja — sin esto se derrama por debajo
                            del fondo oscuro en vez de scrollear adentro de la caja */
}

.sidebar-header h3 {
    color: white;
    margin-bottom: 30px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: #ecf0f1;
    padding: 15px 30px;
    border-bottom: 1px solid #bdc3c7;
}

.user-info {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
}

.content {
    flex: 1;
    min-height: 0;   /* sin esto, una grilla larga (Colectas/Paquetes) empuja .main-content
                        más allá del viewport en vez de scrollear internamente — hace que
                        .app-layout crezca de más y el sidebar quede corto contra la página real */
    padding: 30px;
    overflow-y: auto;
}

/* Navigation */
.nav-menu ul {
    list-style: none;
    margin-bottom: 20px;
}

.nav-menu li {
    margin: 10px 0;
}

.nav-menu a {
    color: #ecf0f1;
    text-decoration: none;
    display: block;
    padding: 10px;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-menu a:hover {
    background: #34495e;
}

.nav-menu a.active {
    background: #3498db;
}

.nav-monitor-btn {
    color: #ecf0f1;
    text-decoration: none;
    display: block;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.2s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
}

.nav-monitor-btn:hover {
    background: #34495e;
}

.nav-monitor-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-info {
    background: #1abc9c;
    color: white;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-logout {
    background: #e74c3c;
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
}

.table tr:hover {
    background: #f8f9fa;
}

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin: 15px 0;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stats-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stats-icon {
    font-size: 32px;
}

.stats-title {
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
}

.stats-value {
    font-size: 28px;
    font-weight: bold;
}

.stats-card-blue .stats-value {
    color: #3498db;
}

.stats-card-yellow .stats-value {
    color: #f39c12;
}

.stats-card-green .stats-value {
    color: #2ecc71;
}

.stats-card-red .stats-value {
    color: #e74c3c;
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #2ecc71;
    color: white;
}

.badge-warning {
    background: #f39c12;
    color: white;
}

.badge-info {
    background: #3498db;
    color: white;
}

.badge-primary {
    background: #9b59b6;
    color: white;
}

.badge-danger {
    background: #e74c3c;
    color: white;
}

.badge-secondary {
    background: #95a5a6;
    color: white;
}

/* Token Cards */
.tokens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.token-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #3498db;
}

.token-card.token-expired {
    border-left-color: #e74c3c;
    opacity: 0.7;
}

.token-header {
    margin-bottom: 15px;
}

.token-chofer {
    font-weight: bold;
    font-size: 16px;
}

.token-proveedor {
    color: #7f8c8d;
    font-size: 14px;
}

.token-code {
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    font-family: monospace;
    color: #2c3e50;
}

.token-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.token-countdown {
    font-size: 18px;
    font-weight: bold;
    color: #3498db;
}

.token-countdown.expired {
    color: #e74c3c;
}

/* Pagination */
.pagination-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.pagination-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-number {
    padding: 0 15px;
}

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    align-items: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.filters label {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    margin-bottom: 30px;
    text-align: center;
    color: #2c3e50;
}

.btn-block {
    width: 100%;
    margin-top: 20px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    outline: none;
}

.modal-content,
.modal-container {
    background: white;
    border-radius: 8px;
    min-width: 420px;
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h4 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #6c757d;
    line-height: 1;
    padding: 2px 6px;
}

.btn-close-modal:hover {
    color: #000;
}

/* Loading */
.loading-spinner {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #7f8c8d;
}

/* Sections */
.section {
    margin: 30px 0;
}

.section h4 {
    margin-bottom: 15px;
    color: #2c3e50;
}

/* Placeholder */
.placeholder-page {
    text-align: center;
    padding: 60px 20px;
}

.placeholder-page h3 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.placeholder-page ul {
    list-style-position: inside;
    color: #7f8c8d;
}

/* Responsive */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }
}
