/* Motor Drive - Industrial Dark Theme with Mechanic Workshop Aesthetic */
* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: #0f172a;
    background-image:
        /* Dark overlay for readability */
        linear-gradient(to bottom, rgba(15, 23, 42, 0.70), rgba(15, 23, 42, 0.85)),
        /* Workshop background image */
        url('icons/workshop-bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overscroll-behavior: none;
}

/* Mobile-specific background: Tool pegboard */
@media (max-width: 768px) {
    body {
        background-image:
            linear-gradient(to bottom, rgba(15, 23, 42, 0.65), rgba(15, 23, 42, 0.85)),
            url('icons/workshop-bg-mobile.png');
    }
}

/* Safe area padding for notched devices */
.safe-area-top {
    padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

.header-bg {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ============ SPLASH SCREEN ============ */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: #0f172a;
    background-image:
        linear-gradient(to bottom, rgba(15, 23, 42, 0.60), rgba(15, 23, 42, 0.80)),
        url('icons/workshop-bg.png');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: splashFadeOut 0.5s ease-out 3.5s forwards;
}

.splash-content {
    text-align: center;
}

.splash-logo {
    width: 180px;
    max-width: 50vw;
    height: 180px;
    max-height: 50vw;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #f97316;
    box-shadow: 0 0 40px rgba(249, 115, 22, 0.5), 0 0 80px rgba(249, 115, 22, 0.2);
    animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    25% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    50% {
        transform: scale(0.95);
        opacity: 1;
    }

    75% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

@keyframes splashFadeOut {
    0% {
        opacity: 1;
        pointer-events: all;
    }

    100% {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }
}

.app-hidden {
    opacity: 0;
    animation: appFadeIn 0.5s ease-out 3.5s forwards;
}

@keyframes appFadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* ============ GLOW EFFECTS ============ */
.glow-orange {
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.3), 0 0 40px rgba(249, 115, 22, 0.1);
}

.glow-green {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.glow-blue {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* ============ ANIMATIONS ============ */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.card-hover:active {
    transform: scale(0.98);
}

.spinner {
    border: 3px solid rgba(249, 115, 22, 0.2);
    border-top-color: #f97316;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ============ STATUS BADGES ============ */
.status-pagado {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.status-pendiente {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.status-abonado {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* ============ INPUTS ============ */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.3);
}

/* ============ SCREENS ============ */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* ============ TOAST ============ */
.toast {
    animation: slideIn 0.3s ease-out, fadeOut 0.3s ease-out 2.7s forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* ============ ACTION BUTTONS ============ */
.action-btn {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

@media (min-width: 640px) {
    .action-btn {
        min-height: 48px;
        min-width: 48px;
    }
}

.action-btn:active {
    transform: scale(0.95);
}

.btn-whatsapp {
    background: linear-gradient(135deg, #25D366, #128C7E);
}

.btn-whatsapp:hover {
    background: linear-gradient(135deg, #128C7E, #075E54);
}

.btn-paid {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.btn-paid:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.btn-abono {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.btn-abono:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.btn-delete {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn-delete:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* ============ VEHICLE CARD ============ */
.vehicle-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

@media (min-width: 640px) {
    .vehicle-card {
        padding: 20px;
    }
}

.vehicle-card:hover {
    border-color: rgba(249, 115, 22, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* Vehicle Photo */
.vehicle-photo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(245, 158, 11, 0.2));
}

@media (min-width: 640px) {
    .vehicle-photo {
        width: 56px;
        height: 56px;
    }
}

.vehicle-photo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(245, 158, 11, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 640px) {
    .vehicle-photo-placeholder {
        width: 56px;
        height: 56px;
    }
}

/* ============ WORK CARD ============ */
.work-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.8));
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 16px;
    padding: 16px;
}

@media (min-width: 640px) {
    .work-card {
        padding: 20px;
    }
}

/* ============ FINANCE CARD ============ */
.finance-card {
    border-radius: 16px;
    padding: 16px;
    border: 1px solid rgba(71, 85, 105, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

@media (min-width: 640px) {
    .finance-card {
        padding: 24px;
    }
}

.finance-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.finance-card:active {
    transform: scale(0.98);
}

.finance-blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(30, 41, 59, 0.9));
    border-color: rgba(59, 130, 246, 0.3);
}

.finance-green {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(30, 41, 59, 0.9));
    border-color: rgba(34, 197, 94, 0.3);
}

.finance-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(30, 41, 59, 0.9));
    border-color: rgba(239, 68, 68, 0.3);
}

/* ============ BREAKDOWN CARD ============ */
.breakdown-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.8));
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
}

/* ============ MODAL ============ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
}

.modal.active {
    display: block;
}

.modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0f172a;
    border-top: 1px solid #334155;
    border-radius: 24px 24px 0 0;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    max-height: 90vh;
    overflow-y: auto;
}

@media (min-width: 640px) {
    .modal-content {
        padding: 24px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* ============ PHOTO UPLOAD ============ */
.photo-upload-btn {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    border: 2px dashed rgba(249, 115, 22, 0.5);
    background: rgba(249, 115, 22, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.photo-upload-btn:hover {
    border-color: #f97316;
    background: rgba(249, 115, 22, 0.2);
}

.photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    object-fit: cover;
    border: 2px solid rgba(249, 115, 22, 0.5);
}

/* ============ RESPONSIVE TYPOGRAPHY ============ */
@media (max-width: 360px) {
    html {
        font-size: 14px;
    }
}

/* ============ TABLET OPTIMIZATIONS ============ */
@media (min-width: 768px) {
    .vehicle-card {
        padding: 24px;
    }

    .work-card {
        padding: 24px;
    }

    .finance-card {
        padding: 28px;
    }

    .modal-content {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 24px;
        bottom: 20px;
    }
}

/* ============ LANDSCAPE TABLET ============ */
@media (min-width: 1024px) {
    .modal-content {
        max-width: 600px;
    }
}