/* Custom CSS for MOTOCONCHO - Mobile First Design */

/* Variables de colores y medidas móviles */
:root {
    --primary-color: #0066cc;
    --secondary-color: #ffc107;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    
    /* Variables móviles */
    --mobile-padding: 16px;
    --mobile-margin: 12px;
    --touch-target: 44px; /* Mínimo para touch targets */
    --mobile-font-base: 16px; /* Evita zoom en iOS */
    --mobile-line-height: 1.5;
    --border-radius-mobile: 12px;
    --shadow-mobile: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Reset y estilos base móviles */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    font-size: var(--mobile-font-base);
    line-height: var(--mobile-line-height);
    padding-top: 60px; /* Navbar móvil más compacto */
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

/* Hero Section - Mobile Optimized */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #004499 100%);
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: var(--mobile-padding);
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="motorcycle" patternUnits="userSpaceOnUse" width="100" height="100"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23motorcycle)"/></svg>');
    opacity: 0.1;
}

.hero-section .container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 100%;
    padding: 0 var(--mobile-padding);
}

/* Hero content mobile */
.hero-section .row {
    text-align: center;
    align-items: center;
}

.hero-section h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-section .lead {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-section .d-flex {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

/* Navbar móvil */
.navbar {
    min-height: 60px;
    padding: 8px var(--mobile-padding);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    padding: 8px 0;
}

.navbar-brand i {
    margin-right: 6px;
    color: var(--secondary-color);
}

.navbar-toggler {
    border: none;
    padding: 6px 8px;
    margin-right: -8px;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-nav {
    padding: 1rem 0;
}

.nav-link {
    padding: 12px 0;
    font-weight: 500;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link:last-child {
    border-bottom: none;
}

/* Dropdown móvil */
.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-mobile);
    border-radius: var(--border-radius-mobile);
    margin-top: 8px;
}

.dropdown-item {
    padding: 12px 20px;
    font-size: 1rem;
}

/* Cards de servicios - Mobile Optimized */
.card {
    border: none;
    border-radius: var(--border-radius-mobile);
    box-shadow: var(--shadow-mobile);
    margin-bottom: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 140px;
}

/* Efectos táctiles para móvil */
.card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (hover: hover) and (pointer: fine) {
    .card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    }
    
    .card:hover .card-body i {
        transform: scale(1.05);
    }
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.card-body i {
    transition: transform 0.2s ease;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-text {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

/* Formulario móvil optimizado */
.form-control {
    border-radius: var(--border-radius-mobile);
    border: 2px solid #e9ecef;
    padding: 12px 16px;
    font-size: var(--mobile-font-base); /* Evita zoom en iOS */
    min-height: var(--touch-target);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
    outline: none;
}

.form-control:invalid {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

/* Labels móviles */
.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* Selectores móviles */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: 40px;
}

/* Textarea móvil */
textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Inputs de fecha y hora móviles */
input[type="datetime-local"].form-control {
    position: relative;
}

/* Botones móviles optimizados */
.btn {
    border-radius: 25px;
    padding: 14px 24px;
    font-weight: 600;
    font-size: 1rem;
    min-height: var(--touch-target);
    min-width: 120px;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

/* Efectos táctiles */
.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), #0052cc);
    color: white;
}

.btn-warning {
    background: linear-gradient(45deg, var(--secondary-color), #e0a800);
    color: #000;
}

.btn-success {
    background: linear-gradient(45deg, var(--success-color), #1e7e34);
    color: white;
}

.btn-outline-light {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: white;
}

/* Hover effects solo en dispositivos que lo soporten */
@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover {
        background: linear-gradient(45deg, #0052cc, var(--primary-color));
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
    }
    
    .btn-warning:hover {
        background: linear-gradient(45deg, #e0a800, var(--secondary-color));
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
    }
    
    .btn-success:hover {
        background: linear-gradient(45deg, #1e7e34, var(--success-color));
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    }
    
    .btn-outline-light:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: white;
        transform: translateY(-1px);
    }
}

/* Botones de tamaño completo en móvil */
.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
    min-height: 50px;
    width: 100%;
    max-width: 300px;
}

/* Botones pequeños */
.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-height: 36px;
}

/* Estados de botones */
.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    transform: none;
    pointer-events: none;
}

/* Modal móvil optimizado */
.modal {
    padding: 0;
}

.modal-dialog {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: flex-end;
}

.modal-content {
    border-radius: var(--border-radius-mobile) var(--border-radius-mobile) 0 0;
    border: none;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 20px var(--mobile-padding);
    position: sticky;
    top: 0;
    background: white;
    z-index: 1020;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-body {
    padding: var(--mobile-padding);
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: var(--mobile-padding);
    position: sticky;
    bottom: 0;
    background: white;
}

/* Botón cerrar móvil */
.btn-close {
    width: var(--touch-target);
    height: var(--touch-target);
    padding: 0;
    margin: 0;
    opacity: 0.8;
}

/* Modal fullscreen en móviles muy pequeños */
@media (max-width: 576px) {
    .modal-dialog {
        align-items: stretch;
    }
    
    .modal-content {
        border-radius: 0;
        height: 100vh;
        max-height: 100vh;
    }
}

/* Iconos */
.fa-motorcycle {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Alertas móviles */
.alert {
    border-radius: var(--border-radius-mobile);
    border: none;
    padding: var(--mobile-padding);
    margin: var(--mobile-margin) 0;
    box-shadow: var(--shadow-mobile);
    position: relative;
    animation: slideInDown 0.3s ease-out;
}

.alert-success {
    background: linear-gradient(45deg, #d4edda, #c3e6cb);
    color: #155724;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background: linear-gradient(45deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.alert-info {
    background: linear-gradient(45deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* Botón cerrar alerta móvil */
.alert .btn-close {
    position: absolute;
    top: 50%;
    right: var(--mobile-padding);
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    opacity: 0.6;
}

/* Animación para alertas */
@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Footer */
footer {
    margin-top: 50px;
}

/* Media queries específicas para diferentes tamaños */

/* Móviles pequeños (320px - 480px) */
@media (max-width: 480px) {
    :root {
        --mobile-padding: 12px;
        --mobile-margin: 8px;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
    
    .container, .container-fluid {
        padding-left: var(--mobile-padding);
        padding-right: var(--mobile-padding);
    }
    
    .row {
        margin-left: calc(-1 * var(--mobile-margin));
        margin-right: calc(-1 * var(--mobile-margin));
    }
    
    .col, [class*="col-"] {
        padding-left: var(--mobile-margin);
        padding-right: var(--mobile-margin);
    }
}

/* Móviles medianos (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.25rem;
    }
    
    .hero-section .d-flex {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn-lg {
        width: auto;
        min-width: 200px;
    }
}

/* Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-section .row {
        text-align: left;
    }
    
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    .modal-dialog {
        margin: 2rem auto;
        align-items: center;
    }
    
    .modal-content {
        border-radius: var(--border-radius-mobile);
        max-height: 80vh;
    }
}

/* Desktop (1025px+) */
@media (min-width: 1025px) {
    body {
        padding-top: 70px;
    }
    
    .navbar {
        min-height: 70px;
        padding: 12px var(--mobile-padding);
    }
    
    .hero-section {
        min-height: 80vh;
    }
    
    .hero-section h1 {
        font-size: 3rem;
    }
    
    .hero-section .d-flex {
        flex-direction: row;
        justify-content: flex-start;
    }
    
    .btn-lg {
        width: auto;
        min-width: auto;
    }
}

/* Animaciones adicionales */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Estilos para elementos deshabilitados */
.form-control:disabled,
.form-control[readonly] {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

/* Secciones con padding móvil */
section {
    padding: 2rem var(--mobile-padding);
}

section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
}

/* Footer móvil */
footer {
    padding: 2rem var(--mobile-padding) 1rem;
    margin-top: 2rem;
}

/* Optimizaciones específicas para WebView y PWA */
.webview-optimized {
    /* Prevenir zoom accidental */
    touch-action: manipulation;
    
    /* Mejorar rendimiento en WebView */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    
    /* Suavizar scrolling */
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}

/* Evitar problemas de viewport en WebView */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Safe areas para dispositivos con notch */
@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(var(--mobile-padding), env(safe-area-inset-left));
        padding-right: max(var(--mobile-padding), env(safe-area-inset-right));
    }
    
    .hero-section,
    section,
    footer {
        padding-left: max(var(--mobile-padding), env(safe-area-inset-left));
        padding-right: max(var(--mobile-padding), env(safe-area-inset-right));
    }
    
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Status bar overlay para PWA */
.pwa-status-bar {
    height: env(safe-area-inset-top);
    background: var(--primary-color);
}

/* Splash screen styling */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #004499 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.splash-logo {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.splash-text {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
}

/* Loading spinner mejorado */
.spinner-border-lg {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Pull to refresh indicator */
.pull-to-refresh {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    background: rgba(0, 102, 204, 0.05);
    transition: all 0.3s ease;
}

/* Haptic feedback visual */
.haptic-feedback {
    animation: hapticPulse 0.1s ease-out;
}

@keyframes hapticPulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --dark-color: #f8f9fa;
        --light-color: #343a40;
    }
    
    body {
        background-color: #1a1a1a;
        color: #f8f9fa;
    }
    
    .card {
        background-color: #2d2d2d;
        color: #f8f9fa;
    }
    
    .modal-content {
        background-color: #2d2d2d;
        color: #f8f9fa;
    }
    
    .form-control {
        background-color: #2d2d2d;
        color: #f8f9fa;
        border-color: #495057;
    }
}