/* ================================
   MTTO FLOTA - PWA Styles
   ================================ */

:root {
    --primary: #7c3aed;
    --primary-dark: #5b21b6;
    --secondary: #38a169;
    --warning: #d69e2e;
    --danger: #e53e3e;
    --gray-100: #f7fafc;
    --gray-200: #edf2f7;
    --gray-300: #e2e8f0;
    --gray-600: #718096;
    --gray-800: #2d3748;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    min-height: 100vh;
}

/* ================================
   Login Screen
   ================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.login-box {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 360px;
}

.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo h1 {
    color: var(--primary-dark);
    font-size: 24px;
    margin-bottom: 5px;
}

.login-logo p {
    color: var(--gray-600);
    font-size: 14px;
}

/* ================================
   Forms
   ================================ */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-800);
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-success {
    background: var(--secondary);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ================================
   App Layout
   ================================ */

.app-container {
    display: none;
    flex-direction: column;
    min-height: 100vh;
}

.app-container.active {
    display: flex;
}

/* Header */
.app-header {
    background: var(--primary);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 18px;
}

.header-info {
    font-size: 12px;
    text-align: right;
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
}

/* Main Content */
.app-content {
    flex: 1;
    padding: 16px;
    padding-bottom: 80px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray-600);
    text-decoration: none;
}

.nav-item.active {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-item .icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.nav-item .label {
    font-size: 11px;
    font-weight: 500;
}

/* ================================
   Sections
   ================================ */

.section {
    display: none;
}

.section.active {
    display: block;
}

.section-title {
    font-size: 20px;
    margin-bottom: 16px;
    color: var(--primary-dark);
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* Equipment Cards */
.equipo-card {
    border-left: 4px solid var(--primary);
}

.equipo-card.alerta-amarillo {
    border-left-color: var(--warning);
}

.equipo-card.alerta-rojo {
    border-left-color: var(--danger);
}

.equipo-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 14px;
}

.equipo-info .label {
    color: var(--gray-600);
}

.equipo-info .value {
    font-weight: 500;
    text-align: right;
}

/* Input Horómetro */
.horometro-input {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.horometro-input input {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.horometro-input input:focus {
    border-color: var(--primary);
    outline: none;
}

/* ================================
   Checklist Styles
   ================================ */

.checklist-section {
    margin-bottom: 20px;
}

.checklist-section-title {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
}

.checklist-items {
    background: white;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.checklist-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

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

.checklist-item-label {
    flex: 1;
    font-size: 14px;
}

.checklist-options {
    display: flex;
    gap: 8px;
}

.option-btn {
    padding: 6px 12px;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.option-btn.selected-si {
    background: var(--secondary);
    border-color: var(--secondary);
    color: white;
}

.option-btn.selected-no {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.option-btn.selected-na {
    background: var(--gray-600);
    border-color: var(--gray-600);
    color: white;
}

/* Motor options (BR/CN/ER) */
.motor-options {
    display: flex;
    gap: 8px;
}

.motor-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.motor-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-600);
}

.motor-btns {
    display: flex;
    gap: 2px;
}

.motor-btn {
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
    background: white;
    cursor: pointer;
    font-size: 11px;
}

.motor-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.motor-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.motor-btn.selected-si {
    background: var(--secondary);
    border-color: var(--secondary);
    color: white;
}

.motor-btn.selected-no {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* ================================
   Alerts & Messages
   ================================ */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #c6f6d5;
    color: #276749;
}

.alert-warning {
    background: #fefcbf;
    color: #744210;
}

.alert-danger {
    background: #fed7d7;
    color: #c53030;
}

.alert-info {
    background: #bee3f8;
    color: #2b6cb0;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success {
    background: var(--secondary);
    color: white;
}

.badge-warning {
    background: var(--warning);
    color: white;
}

.badge-danger {
    background: var(--danger);
    color: white;
}

/* ================================
   Loading
   ================================ */

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================
   Responsive
   ================================ */

@media (min-width: 768px) {
    .app-content {
        max-width: 600px;
        margin: 0 auto;
    }
}

/* ================================
   PWA Install Banner
   ================================ */

.install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

.install-banner.hidden {
    display: none;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.install-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    overflow: hidden;
}

.install-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.install-text {
    flex: 1;
    min-width: 0;
}

.install-text strong {
    display: block;
    font-size: 14px;
    color: var(--gray-800);
    margin-bottom: 2px;
}

.install-text span {
    font-size: 12px;
    color: var(--gray-600);
}

.btn-close-banner {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-600);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.btn-close-banner:hover {
    color: var(--gray-800);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
