/* ==========================================================================
   MotoTaller - Estilos Base Mobile-First
   ========================================================================== */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --navbar-height: 56px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--dark-color);
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--navbar-height);
}

/* ==========================================================================
   Layout Principal
   ========================================================================== */

.main-content {
    flex: 1;
    padding: 1rem;
    margin-bottom: 60px;
}

.footer {
    margin-top: auto;
    background-color: var(--light-color);
}

/* ==========================================================================
   Navbar Optimizado para Móvil
   ========================================================================== */

.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-nav .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
}

.dropdown-item-form {
    padding: 0;
    margin: 0;
}

.dropdown-item-form button {
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

/* ==========================================================================
   Cards y Estadísticas
   ========================================================================== */

.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    margin-bottom: 1rem;
}

.card-stat {
    border: none;
    border-radius: 0.5rem;
    transition: transform 0.2s;
}

.card-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-stat .card-body {
    padding: 1rem;
}

.card-stat h6 {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.card-stat h3 {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

/* ==========================================================================
   Actividad Feed
   ========================================================================== */

.activity-feed {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--secondary-color);
    display: block;
    margin-bottom: 0.25rem;
}

/* ==========================================================================
   Botones Optimizados para Táctil
   ========================================================================== */

.btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: 0.375rem;
}

.btn-lg {
    min-height: 48px;
    font-size: 1.1rem;
}

.btn-sm {
    min-height: 36px;
    font-size: 0.875rem;
}

/* ==========================================================================
   Formularios Mobile-First
   ========================================================================== */

.form-control,
.form-select {
    min-height: 44px;
    font-size: 1rem;
    border-radius: 0.375rem;
}

.form-control-lg {
    min-height: 48px;
    font-size: 1.1rem;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Lista de Items con Acciones
   ========================================================================== */

.list-group-item {
    padding: 1rem;
    border-left: none;
    border-right: none;
}

.list-group-item:first-child {
    border-top: none;
}

.list-group-item-action {
    transition: background-color 0.15s ease-in-out;
}

.list-group-item-action:active {
    background-color: var(--light-color);
}

/* ==========================================================================
   Utilidades Mobile
   ========================================================================== */

.text-truncate-mobile {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.touch-action-pan-y {
    touch-action: pan-y;
}

/* ==========================================================================
   Responsive: Tablets (768px+)
   ========================================================================== */

@media (min-width: 768px) {
    .main-content {
        padding: 1.5rem;
    }

    .card-stat h6 {
        font-size: 0.875rem;
    }

    .card-stat h3 {
        font-size: 2rem;
    }

    .stat-icon {
        font-size: 3rem;
    }
}

/* ==========================================================================
   Responsive: Desktop (992px+)
   ========================================================================== */

@media (min-width: 992px) {
    .main-content {
        padding: 2rem;
    }

    .container-fluid {
        max-width: 1400px;
    }
}

/* ==========================================================================
   Mejoras de Accesibilidad
   ========================================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   Animaciones Suaves
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
    * {
        scroll-behavior: smooth;
    }
}

/* ==========================================================================
   Loading Overlay — pantalla de carga global
   ========================================================================== */

#loadingOverlay {
    position: fixed;
    inset: 0;                              /* top/right/bottom/left: 0 */
    background: rgba(15, 23, 42, 0.55);   /* fondo oscuro semitransparente */
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Estado inicial: oculto */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

/* Clase que activa la visibilidad */
#loadingOverlay.show {
    opacity: 1;
    visibility: visible;
}

/* Caja blanca central */
.loading-box {
    background: #ffffff;
    border-radius: 1rem;
    padding: 2rem 2.75rem;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
    min-width: 170px;
    /* Animación de entrada con ligero scale */
    transform: scale(0.88);
    transition: transform 0.22s ease;
}

#loadingOverlay.show .loading-box {
    transform: scale(1);
}

/* Spinner grande */
.loading-spinner {
    width: 3rem;
    height: 3rem;
}

/* Texto bajo el spinner */
#loadingText {
    margin: 0.85rem 0 0 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    letter-spacing: 0.03em;
}

/* Spinner inline en botones al enviar formulario */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}
