/* =========================================================
   RESET + IMPORT + VARIABLES
========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #4f46e5;
    --primary-light: #eef2ff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-app: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
              0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.2s ease;
}

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

/* =========================================================
   BASE
========================================================= */

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    padding: 40px 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 40px;
    color: var(--text-main);
    letter-spacing: -1px;
}

/* =========================================================
   FORMULARIO
========================================================= */

.car-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;

    background: var(--white);
    padding: 30px;
    margin-bottom: 50px;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* Inputs generales */
.car-form input,
.car-form select {
    width: 100%;
    padding: 12px 16px;

    font-family: inherit;
    font-size: 0.95rem;

    background: #fdfdfd;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    transition: var(--transition);
}

.car-form input:focus,
.car-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Grupo color */
.car-form .color-badge {
    grid-column: span 2;
    background: transparent;
    border: none;
    padding: 0;
}

.car-form input[type="color"] {
    width: 50px;
    height: 45px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

/* Foto */
.input-foto {
    grid-column: span 2;

    padding: 15px;
    text-align: center;

    background: var(--primary-light);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
}

.input-foto label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Botón */
.btn-submit {
    grid-column: 1 / -1;

    padding: 15px;

    font-size: 1rem;
    font-weight: 700;
    color: white;

    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;

    transition: var(--transition);
}

.btn-submit:hover {
    background: #4338ca;
    transform: translateY(-2px);
}

/* =========================================================
   RESPONSIVE FORMULARIO
========================================================= */

@media (max-width: 768px) {

    .car-form {
        grid-template-columns: 1fr;
    }

    .car-form .color-badge,
    .input-foto {
        grid-column: span 1;
    }

    .btn-submit {
        grid-column: span 1;
    }
}

/* =========================================================
   TABLA DE INVENTARIO
========================================================= */

.table-container {
    overflow: hidden;

    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 16px;

    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;

    background: #f1f5f9;
    color: var(--text-muted);
}

td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

/* =========================================================
   CELDAS ESPECÍFICAS
========================================================= */

.img-preview {
    display: block;
    width: 70px;
    height: 50px;
    object-fit: cover;

    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.marca-cell {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.modelo-cell {
    font-weight: 500;
    color: var(--text-main);
}

.color-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 4px 12px;

    font-size: 0.85rem;

    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 20px;
}

.color-circle {
    width: 12px;
    height: 12px;

    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.status-badge {
    padding: 6px 12px;

    font-size: 0.75rem;
    font-weight: 700;

    border-radius: 8px;
}

/* =========================================================
   COLORES DE ESTADO
========================================================= */

.nuevo     { background: #dcfce7; color: #166534; }
.seminuevo { background: #dbeafe; color: #1e40af; }
.ocasion   { background: #fef3c7; color: #92400e; }
.averiado  { background: #fee2e2; color: #991b1b; }

/* =========================================================
   ACCIONES - ELIMINACIÓN TOTAL DE LÍNEAS
========================================================= */

/* 1. Quitamos cualquier línea de la celda */
td[data-label="Acciones"], 
.actions {
    border-bottom: 1px solid var(--border); /* Solo la línea divisoria de la fila */
    text-decoration: none !important;
}

/* 2. Botones: Limpieza absoluta */
.btn-edit,
.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    
    /* Esto elimina la línea de texto (subrayado) */
    text-decoration: none !important; 
    border-bottom: none !important;
    outline: none !important;
    box-shadow: none !important;

    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1.2rem;
    transition: var(--transition);
    
    /* Evita que el navegador fuerce colores de link */
    cursor: pointer;
}

/* 3. Colores de fondo para que parezcan botones, no texto */
.btn-edit { 
    background-color: #fef9c3 !important; 
    color: #a16207 !important; 
}

.btn-delete { 
    background-color: #fee2e2 !important; 
    color: #b91c1c !important; 
}

/* 4. Efecto Hover limpio */
.btn-edit:hover,
.btn-delete:hover {
    filter: brightness(0.9);
    transform: translateY(-2px);
    text-decoration: none !important; /* Reafirmamos que no salga línea al pasar el ratón */
}

/* 5. Ajuste de la celda para que no se estire */
td:last-child {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

/* =========================================================
   MODO MÓVIL (TARJETAS)
========================================================= */

@media (max-width: 850px) {

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        margin-bottom: 20px;
        padding: 15px;

        background: var(--white);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
    }

    td {
        display: flex;
        justify-content: space-between;
        align-items: center;

        padding: 10px 0;
        text-align: right;

        border-bottom: 1px solid #f8fafc;
    }

    td:last-child {
        border-bottom: none;
    }

    td::before {
        content: attr(data-label);

        margin-right: 15px;

        font-size: 0.8rem;
        font-weight: 700;
        text-transform: uppercase;

        color: var(--text-muted);
    }

    .img-preview {
        width: 100px;
        height: 60px;
    }
}