/* styles.css */

/* ============================================= */
/* --- RESET BÁSICO Y LAYOUT GENERAL --- */
/* ============================================= */

body {font-family: Arial, sans-serif; margin: 0; background-color: #f8f8f8;color: #333;min-height: 100vh;display: flex; flex-direction: column;}
#app-container {max-width: 1350px;width: 100%;margin: 30px auto;padding: 20px; box-sizing: border-box; flex-grow: 1;}
h1, h2, h3, h4 {color: #007bff;margin-top: 0;}
h1 {font-size: 2.2em;margin-bottom: 5px;border-bottom: 2px solid #007bff;padding-bottom: 5px;}
a {color: #007bff;text-decoration: none;}
a:hover {text-decoration: underline;}

/* ============================================= */
/* --- HEADER, FOOTER Y NAVEGACIÓN PRINCIPAL --- */
/* ============================================= */

.site-header {background-color: #333;padding: 10px 20px;box-shadow: 0 2px 5px rgba(0,0,0,0.2);position: sticky;top: 0;z-index: 999;}

.main-navigation {display: flex;justify-content: center;flex-wrap: wrap;gap: 15px;}
.main-navigation a {color: white; text-decoration: none; font-weight: bold; font-size: 0.9em; padding: 8px 12px; border-radius: 5px; transition: background-color 0.3s, color 0.3s;}
.main-navigation a:hover {background-color: #007bff;color: white !important; text-decoration: none;}
.site-footer-main {text-align: center;padding: 20px;background-color: #333;color: #ccc; font-size: 0.9em; margin-top: 30px;}

/* --- MENÚ HAMBURGUESA (MÓVIL) --- */
.hamburger-menu {display: none;position: relative; z-index: 1010;background-color: transparent;border: none;padding: 10px;cursor: pointer;}
.hamburger-box {width: 30px;height: 24px;display: inline-block;position: relative;}
.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {width: 100%;height: 3px; background-color: #fff;border-radius: 4px;position: absolute;transition: transform 0.2s ease-in-out;}

.hamburger-inner {
    top: 50%;transform: translateY(-50%);
}

.hamburger-inner::before,
.hamburger-inner::after {
    content: '';
}

.hamburger-inner::before {
    top: -10px;
}

.hamburger-inner::after {
    bottom: -10px;
}

/* ============================================= */
/* --- ESTILOS DE PÁGINAS ESPECÍFICAS --- */
/* ============================================= */

/* --- LOGIN (login.php) --- */
body.body-login { background-image: url('fondo.webp');background-size: cover; background-position: center center;background-attachment: fixed; background-repeat: no-repeat;}
body.body-login #app-container {margin: 0;display: flex;justify-content: center;align-items: center;max-width: 100%;}

#login-container {max-width: 350px;width: 90%;margin: 20px auto;padding: 25px;background-color: rgba(255, 255, 255, 0.9);border: 1px solid #ddd;border-radius: 8px;box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);text-align: center;backdrop-filter: blur(5px);}
#login-container h1 {    margin-bottom: 20px;color: #007bff;}
#login-container form {display: flex;flex-direction: column;}
#login-container label {text-align: left;margin-bottom: 5px;font-weight: bold;font-size: 0.9em;}
#login-container input[type="text"],
#login-container input[type="password"] {padding: 10px;margin-bottom: 15px;border: 1px solid #ccc;border-radius: 4px;font-size: 1em;width: 100%;box-sizing: border-box;}
#login-container button {background-color: #007bff;color: white;padding: 12px;border: none;border-radius: 4px;cursor: pointer;font-size: 1.1em;transition: background-color 0.3s;}
#login-container button:hover {background-color: #0056b3;}

/* --- DASHBOARD (index.php) --- */
.dashboard-grid {display: flex;flex-wrap: wrap;gap: 20px;margin-top: 30px;justify-content: center;}
.dashboard-card {flex-basis: 300px;flex-grow: 0;background-color: white; border: 1px solid #ddd; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);transition: transform 0.3s, box-shadow 0.3s;text-align: center;padding: 20px;box-sizing: border-box;}
.dashboard-card:hover {transform: translateY(-5px);box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);border-color: #007bff;}
.dashboard-card a {display: flex;flex-direction: column;justify-content: center;align-items: center;width: 100%;height: 100%;color: #333;font-size: 1.1em;font-weight: bold;text-decoration: none;}
.dashboard-card a i {font-size: 3em;margin-bottom: 10px;display: block; color: #007bff;font-family: 'Twemoji Mozilla', 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;}

/* --- ESCÁNER (scanner.php) --- */
#scanner-interface {position: relative;width: 100%;max-width: 500px;height: 350px;overflow: hidden;margin: 10px auto;background: #000;}
#scanner-interface .viewport,#scanner-interface video,#scanner-interface canvas { width: 100% !important; height: 100% !important; position: absolute !important; left: 0 !important; top: 0 !important; object-fit: cover;}

/* --- COLECCIÓN (mycollection.php) --- */
#main-shelf-container {display: flex;flex-wrap: wrap;gap: 30px;padding: 30px;background-color: #5a2e0e;border-radius: 8px;box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6);min-height: 400px;justify-content: center;align-items: flex-start;}

/* cambiando a bordes bonitos
.main-collection-card {background-color: #f0f0f0;border: 2px solid #333;border-radius: 8px;padding: 15px;text-align: center;width: 250px;cursor: pointer;box-shadow: 8px 8px 15px rgba(0, 0, 0, 0.4);transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;transform: translateY(-15px);
}*/
.main-collection-card {padding: 15px;text-align: center;width: 250px;cursor: pointer;transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;transform: translateY(-15px);
/* --- ESTILO RIDGE / BISELADO --- */
    border-radius: 12px;
    background: #f0f0f0; /* Color de fondo original de la tarjeta */
    border: 2px solid #8B4513;
    box-shadow: 
        inset 2px 2px 4px rgba(255, 235, 150, 0.7),
        inset -2px -2px 4px rgba(101, 58, 2, 0.6),
        8px 8px 25px rgba(0, 0, 0, 0.5);
}

.main-collection-card img {max-width: 100%;max-height: 200px;border-radius: 5px;margin-bottom: 10px;border: 1px solid #ccc;}
.main-collection-card:hover {transform: translateY(-16px) scale(1.05);box-shadow: 10px 10px 15px rgba(0, 0, 0, 0.4);border-color: #007bff;}

.manga-grid {display: flex;flex-wrap: nowrap;overflow-x: auto;gap: 20px;padding: 20px 10px;margin-bottom: 30px;background-color: #d2b48c;box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.2);min-height: 280px;border-radius: 5px;}
.manga-item {flex-shrink: 0;width: 150px;border: 1px solid #333;border-radius: 3pxpadding: 5px;text-align: center;background-color: #fff;box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.3);transform: translateY(-5px);transition: transform 0.2s;}
.manga-item img {max-width: 100%;max-height: 180px;display: block;margin: 0 auto 5px auto;}

.shelf-label {background-color: #ffc107;color: #333;padding: 5px 10px;border-radius: 3px 3px 0 0;font-weight: bold;text-transform: uppercase;box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);position: static;transform: none;display: block;width: fit-content;margin-bottom: 10px;}

/* ============================================ */
/* --- ESTILOS DE COMPONENTES REUTILIZABLES --- */
/* ============================================ */

/* --- FONDOS DE PÁGINA --- */
body.has-custom-bg #app-container,.body-background #app-container {background-color: rgba(255, 255, 255, 0.92); border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);}

/* --- FORMULARIOS --- */
fieldset {border: 1px solid #ddd;border-radius: 6px; padding: 15px;margin-bottom: 20px;}
legend {font-weight: bold;color: #007bff;padding: 0 10px;}

fieldset input[type="text"],fieldset input[type="number"],fieldset input[type="url"],fieldset input[type="email"],fieldset input[type="password"],fieldset select,fieldset textarea {
    width: 100%;
    max-width: 450px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* --- TABLAS Y ACORDEÓN --- */
table {border-collapse: collapse;width: 100%;margin-top: 15px;}
th, td {border: 1px solid #dee2e6;padding: 8px;text-align: left;}
th {background-color: #e9ecef;}

.table-responsive {display: block;width: 100%;overflow-x: auto;-webkit-overflow-scrolling: touch;border-radius: 6px;margin-bottom: 1.5em;}

/* Tabla con scroll (managebooks.php) */
.table-scrollable {border: 1px solid #ddd;}
.table-scrollable th,.table-scrollable td {white-space: nowrap;} /* Fuerza el scroll */

/* Tabla en formato tarjeta (scanner.php) */
/* El div .table-responsive no necesita borde aquí */
.table-responsive:not(.table-scrollable) {border: none;overflow-x: hidden;}

/*anterior  .category-header{display:flex;align-items:center;cursor:pointer;padding:10px;margin-top:15px;border: 1px solid #ddd;user-select: none;transition: background-color 0.2s;}  */
.category-header{display:flex;align-items:center;cursor:pointer;padding:10px;margin-top:5px;border:1px solid #ddd;-webkit-user-select:none;user-select:none;transition:background-color .2s;background-color:#fff}
.category-header:hover{background-color:#f8f9fa}
.category-header h4{margin:0;flex-grow:1}
.category-header[data-level="0"]{background-color:#007bff;color:white!important;font-size:1.2em;border-radius:5px 5px 0 0;border-color:#0056b3;padding-left: 15px !important;}
.category-header[data-level="0"] h4{color:#fff!important}
.toggle-icon{display:inline-block;width:0;height:0;margin-right:8px;vertical-align:middle;border-top:6px solid transparent;border-bottom:6px solid transparent;border-left:6px solid;transition:transform .3s ease-in-out}
.category-header[data-level="0"] .category-counter {
    color: #d1eaff !important; /* Un color claro que solo se usa en el fondo azul */
}.category-header.active .toggle-icon{transform:rotate(90deg)}
.accordion-content{display:none;padding:15px;border:1px solid #ddd;border-top:none;background-color:#fdfdfd}
.category-thumbnail{width:40px;height:40px;object-fit:cover;border-radius:4px;margin-right:10px;background-color:#f0f0f0}
.category-thumbnail-placeholder{display:inline-block;width:40px;height:40px;margin-right:10px}
.category-header:hover {transform: translateY(-1px);box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);border-color: #007bff;}

/* --- BOTONES Y ENLACES ESPECIALES --- */

.add-new-button-link {display: inline-block;background-color: #28a745;color: white !important;padding: 8px 15px;border-radius: 5px;font-size: 1.1em;font-weight: bold;margin-top: 10px;text-decoration: none;transition: background-color 0.3s;}
.add-new-button-link:hover {background-color: #1e7e34;text-decoration: none;}

/* --- MODALES --- */
.modal {display: none;position: fixed;z-index: 1000;left: 0;top: 0;width: 100%;height: 100%; /*overflow: auto;*/ background-color: rgba(0, 0, 0, 0.6);}

/*cambiando a borde bonito
.modal-content {background-color: #fefefe; margin: 5% auto;padding: 20px;border: 1px solid #888;width: 80%; max-width: 1151px; border-radius: 10px; box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);}
*/
.modal-content { position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);animation: zoomIn 0.3s ease-out forwards;max-height: 90vh;overflow-y: auto;padding: 20px;width: 80%;max-width: 900px;
    /* --- ESTILO RIDGE / BISELADO --- */
    border-radius: 12px;
    background: #fefefe;
    border: 2px solid #8B4513; 
    box-shadow: 
        inset 3px 3px 6px rgba(255, 235, 150, 0.7),
        inset -3px -3px 6px rgba(101, 58, 2, 0.6),
        0 8px 20px rgba(0, 0, 0, 0.5);
}

.close-button {color: #aaa;float: right;font-size: 28px;font-weight: bold;}

/* ================================ */
/* --- MODAL DE DETALLE (FICHA) --- */
/* ================================ */

.detail-modal { z-index: 1050;}

/* para popup de manga */
.detail-modal-content {max-width: 820px;background: #fdfdfd;}

#detailModalBody {display: grid; grid-template-columns: 250px 1fr; /* Columna imagen fija, columna info flexible */grid-template-rows: auto 1fr; /* Filas automáticas */    align-items: start; gap: 0 25px;}

.carousel-wrapper {grid-column: 1 / 2; /* Ocupa la primera columna */grid-row: 1 / 3; /* Ocupa ambas filas verticalmente */width: 250px; position: relative; display: flex; /* Para centrar si no hay carrusel */align-items: center;}

/* --- CONTENEDOR DE IMAGEN/CARRUSEL (MODIFICADO) --- */
.carousel-container {position: relative;overflow: hidden;width: 100%;border-radius: 8px;background-color: #f0f0f0; /* Fondo si la imagen no carga */min-height: 300px;}
.carousel-track {display: flex;transition: transform 0.4s ease-in-out;}

/* --- ESTILOS DE LA IMAGEN (MODIFICADO) --- */
.carousel-track img {width: 100%; height: auto; flex-shrink: 0; display: block; object-fit: contain; /* Asegura que toda la imagen quepa */max-height: 450px; margin: 0 auto;/* Centra horizontalmente si es más estrecha */}

/* Estilos de botones y puntos del carrusel (sin cambios) */
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background-color: rgba(0, 0, 0, 0.45); color: white; border: none; cursor: pointer; z-index: 10; width: 35px; height: 35px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s; }
.carousel-btn:hover { background-color: rgba(0, 0, 0, 0.7); }
.carousel-btn.prev { left: 8px; }
.carousel-btn.next { right: 8px; }
.carousel-btn:disabled { opacity: 0.2; cursor: default; }
.carousel-dots { position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; padding-top: 15px; }
.carousel-dot { width: 8px; height: 8px; border-radius: 50%; background-color: #ccc; cursor: pointer; }
.carousel-dot.active { background-color: #007bff; }

/* Estilos de la información */
.info {grid-column: 2 / 3;grid-row: 1 / 3; display: flex;flex-direction: column;min-width: 0;height: 100%;}
.info h3 { margin-top: 0; color: #007bff; }
.info .details { margin-bottom: 15px; }
.info p { flex-grow: 1; white-space: pre-wrap; overflow-y: auto; background: #f4f4f4; padding: 10px; border: 1px solid #e1e1e1; border-radius: 4px; margin-bottom: 15px; }
.info .buy-link { display: inline-block; padding: 10px 18px; background-color: #007bff; color: white; text-decoration: none; border-radius: 5px; font-weight: bold; text-align: center; transition: background-color 0.2s; }
.info .buy-link:hover { background-color: #0056b3; }

/* Fin de la sección del modal de detalle */


/* ================================== */
/* --- ESTILOS PARA LA PAGINACIÓN --- */
/* ================================== */

.pagination-container {display: flex;justify-content: center;margin-top: 20px;}
.pagination {list-style: none;padding: 0;display: flex;gap: 5px;}
.pagination li a {display: block;padding: 8px 12px;border: 1px solid #ddd;background-color: #fff;color: #007bff;text-decoration: none;border-radius: 4px;transition: background-color 0.2s, color 0.2s;}
.pagination li a:hover {background-color: #f0f0f0;}
.pagination li.active a {background-color: #007bff;color: white;border-color: #007bff;cursor: default;}

/* ============================================= */
/* --- MEDIA QUERIES: OPTIMIZACIÓN MÓVIL --- */
/* ============================================= */

@media (max-width: 850px) {
    /* NAVEGACIÓN PRINCIPAL */
    .site-header {display: flex;justify-content: flex-end;align-items: center;}
    .hamburger-menu {display: block;}
    .main-navigation {position: fixed;top: 0;left: 0;width: 280px;height: 100vh;background-color: #333;transform: translateX(-100%);transition: transform 0.3s ease-in-out;flex-direction: column;justify-content: flex-start;padding-top: 80px;gap: 0;z-index: 1000;box-sizing: border-box;}
    .main-navigation.is-active {transform: translateX(0);}
    .main-navigation a {padding: 15px 20px;width: 100%;text-align: left;border-bottom: 1px solid #444;box-sizing: border-box;}
    .hamburger-menu.is-active .hamburger-inner {transform: rotate(45deg);}
    .hamburger-menu.is-active .hamburger-inner::before {top: 0;transform: rotate(-90deg);}
    .hamburger-menu.is-active .hamburger-inner::after {bottom: 0;transform: rotate(-90deg);opacity: 0;}
}

@media (max-width: 768px) {
    body { margin: 0; }
    #app-container {padding: 10px;margin: 0;}
    #login-container {margin: 40px 10px; max-width: none;}
    #scanner-interface {
        width: 100% !important;
        max-width: 100% !important;
        height: 40vh;
        min-height: 250px;
        margin: 10px auto !important;
    }
    #camera-selector button {flex-basis: auto;font-size: 0.8em;}
    #main-shelf-container {flex-direction: column;padding: 15px;gap: 20px;min-height: auto;}
    .main-collection-card {width: 90%;max-width: 100%;transform: none;}
    .manga-grid {
        padding: 10px;
        min-height: 250px;
    }
    .manga-item {
        width: 120px;
    }

    /* --- DASHBOARD MÓVIL (NUEVO DISEÑO EN 2 COLUMNAS) --- */
    .dashboard-grid {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around; 
        gap: 15px;
        padding: 0 10px;
    }
    
    .dashboard-card {
        /* Calculamos el ancho para 2 columnas, restando la mitad del 'gap' */
        flex-basis: calc(50% - 10px);
        width: auto;
        margin: 0;
        padding: 15px 10px;
    }
    
    .dashboard-card a {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        font-size: 0.9em;
        text-align: left; 
    }
    
    .dashboard-card a i {
        font-size: 1.6em;
        margin-right: 10px;
        margin-bottom: 0;
    }
    
    /* --- CORRECCIÓN FINAL: Estilos de tablas para móvil --- */
    .table-responsive:not(.table-scrollable) table thead {
        display: none;
    }
    .table-responsive:not(.table-scrollable) table tr {
        display: block;
        border: 1px solid #ddd;
        border-radius: 6px;
        margin-bottom: 15px;
        padding: 10px;
    }
    .table-responsive:not(.table-scrollable) table td {
        display: block;
        text-align: right;
        position: relative;
        padding-left: 50%;
        border: none;
        white-space: normal; /* Permite que el texto se divida en varias líneas */
    }
    .table-responsive:not(.table-scrollable) table td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        font-weight: bold;
        text-align: left;
        white-space: nowrap;
    }

    /* --- MODAL DE DETALLE EN MÓVIL --- */
    .detail-modal-content {
        max-width: 95%;
        padding: 15px;
        margin-top: 20px;
    }
    
    #detailModalBody {
        display: flex;         
        flex-direction: column;
        gap: 20px;             
    }
    
    .carousel-wrapper {
        grid-column: unset;
        grid-row: unset;
        width: 100%;
        max-width: 250px;  
        margin: 0 auto;      
    }
    
    .carousel-container {
        min-height: 380px;
    }
    
    .info {
        grid-column: unset;
        grid-row: unset;
        width: 100%;
        min-height: auto;
    }
    
    .info h3 {
        font-size: 1.5em;
    }
}

/* --- ESTILO PARA EL CONTADOR EN EL ACORDEÓN --- */
.category-counter {
    color: #6c757d;      
    font-size: 0.8em;    
    font-weight: normal; 
    margin-left: 10px;   
}

/* --- Estilos para la superposición en las cartas --- */
.card-item {
    position: relative; /* Necesario para posicionar la superposición */
}

.card-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0; /* Oculto por defecto */
    transition: opacity 0.3s;
}

.card-item:hover .card-item-overlay {
    opacity: 1; /* Visible al pasar el ratón */
}

.card-item-overlay .card-code {
    font-size: 0.8em;
    font-weight: bold;
}

.card-item-overlay .remove-button {
    font-size: 0.8em;
    color: #ffcccc;
    text-decoration: none;
}
.card-item-overlay .remove-button:hover {
    color: #ff4d4d;
    text-decoration: underline;
}

/* ==================================================== */
/* --- NUEVO DISEÑO "PRO" PARA MODAL DE CARTAS --- */
/* ==================================================== */

/* defino aqui ancho para popup de cards, aunque si quito el ancho lo heredaria de detail-modal-content */
.card-detail-modal-content {
    max-width: 820px;
    background: #2c3e50; /* Fondo oscuro */
    color: #ecf0f1;
    border: 1px solid #34495e;
}

.card-detail-layout-pro {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
}

.card-detail-image-pro {
    position: relative;
    align-self: center;
}

.card-detail-image-pro img {
    width: 100%;
    border-radius: 14px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.card-rarity-pro {
    position: absolute;
    bottom: 0px;
    left: 0;
    right: 0;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    color: #f1c40f;
    padding: 5px 0;
    font-weight: bold;
    border-radius: 0 0 14px 14px;
}

.card-detail-info-pro h3 {
    color: #ffffff;
    margin-top: 0;
    font-size: 1.8em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

.card-detail-info-pro h3 span {
    font-size: 0.7em;
    color: #bdc3c7;
}

.card-detail-info-pro p {
    color: #bdc3c7;
}

.stats-grid-pro {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.stat-bar-pro {
    padding: 8px;
    border-radius: 5px;
    text-align: center;
    color: white;
    font-weight: bold;
}
.stat-bar-pro span {
    display: block;
    font-size: 0.8em;
    opacity: 0.8;
}
.stat-bar-pro strong {
    font-size: 1.6em;
    letter-spacing: 1px;
}

.hp-bar { background: linear-gradient(to right, #2ecc71, #27ae60); }
.power-bar { background: linear-gradient(to right, #e74c3c, #c0392b); }
.guard-bar { background: linear-gradient(to right, #f39c12, #e67e22); }

.abilities-scroll-container-pro {
    max-height: 220px;
    overflow-y: auto;
}

.ability-box-pro {
    background: #34495e;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
}

.ability-title-pro {
    background: #46627f;
    padding: 8px 12px;
    font-weight: bold;
}
.ability-title-pro span {
/*    background: #3498db;    */
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    margin-right: 8px;
}

.ability-desc-pro {
    padding: 12px;
    font-size: 0.9em;
    color: #bdc3c7;
}

@media (max-width: 768px) {
    .card-detail-layout-pro { grid-template-columns: 1fr; }
    .card-detail-image-pro { max-width: 240px; margin: auto; }
}

/* no se usa mas en find_card.php
.card-result-container {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        align-items: flex-start;
        border: 1px solid #ddd;
        padding: 15px;
        border-radius: 8px;
        background-color: #f9f9f9;
    }
    .card-result-image {
        flex-basis: 200px;
        flex-grow: 0;
    }
    .card-result-image img {
        width: 100%;
        border-radius: 10px;
    }
    .card-result-info {
        flex-basis: 300px;
        flex-grow: 1;
    }
    .card-result-info h3 {
        margin-top: 0;
    }
    
*/

/* ============================================= */
/* --- ESTILOS PARA NUEVO MENÚ DESPLEGABLE --- */
/* ============================================= */

/* Contenedor de un item del menú que tendrá desplegable */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

/* El enlace que activa el desplegable */
.dropdown-toggle .fa-chevron-down {
    font-size: 0.7em;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

/* Contenedor del menú desplegable (oculto por defecto) */
.dropdown-menu {
    display: none;
    position: absolute;
    background-color: #3d3d3d;
    min-width: 240px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    z-index: 1001; /* Debe estar por encima del header */
    border-radius: 0 0 5px 5px;
    overflow: hidden; /* Para que los bordes redondeados se apliquen a los hijos */
}

/* Enlaces dentro del menú desplegable */
.dropdown-menu a {
    color: #f2f2f2;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.85em !important;
    border-bottom: 1px solid #555;
    transition: background-color 0.2s;
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

/* Línea divisoria en el menú desplegable */
.dropdown-menu hr {
    border: 0;
    height: 1px;
    background-color: #555;
    margin: 0;
}

/* Hover en escritorio: Muestra el menú */
.nav-dropdown:hover .dropdown-menu {
    display: block;
}

.nav-dropdown:hover .dropdown-toggle .fa-chevron-down {
    transform: rotate(180deg);
}

.dropdown-menu a:hover {
    background-color: #575757;
    color: #fff !important;
}

/* Separador visual para el botón de logout */
.nav-logout {
    border-left: 1px solid #555;
}


/* --- OPTIMIZACIÓN MÓVIL PARA EL MENÚ --- */
@media (max-width: 850px) {
    .main-navigation {
        overflow-y: auto; /* Permite scroll si hay muchos items */
    }

    /* En móvil, el desplegable no es absoluto */
    .nav-dropdown {
        display: block;
        width: 100%;
    }

    .dropdown-toggle, .main-navigation a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    .dropdown-menu {
        position: static;
        display: none; /* Oculto por defecto, se mostrará con JS */
        width: 100%;
        box-shadow: none;
        background-color: rgba(0,0,0,0.2);
        border-radius: 0;
        padding-left: 20px; /* Indentación para sub-items */
        box-sizing: border-box;
    }

    /* Cuando el menú está abierto en móvil */
    .dropdown-menu.is-open {
        display: block;
    }
    
    .dropdown-toggle.is-open .fa-chevron-down {
        transform: rotate(180deg);
    }
    
    .dropdown-menu a {
        border: none !important;
    }

    /* Hover en escritorio: Muestra el menú SÓLO en pantallas grandes */
    @media (min-width: 851px) {
        .nav-dropdown:hover .dropdown-menu {
            display: block;
        }
    
        .nav-dropdown:hover .dropdown-toggle .fa-chevron-down {
            transform: rotate(180deg);
        }
    }
    .nav-logout {
        border-left: none; /* Quitamos el borde en móvil */
        margin-top: 20px; /* Espacio antes del logout */
        border-top: 1px solid #444;
    }

    /* Overlay para oscurecer la página al abrir el menú */
    .page-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 998; /* Justo debajo del menú */
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    }

    .page-overlay.is-active {
        opacity: 1;
        visibility: visible;
    }
}

/* ============================================= */
/* --- ESTILO "MARCO ENERGÉTICO" SOLO PARA CARTAS --- */
/* ============================================= */

.marco-carta-espectacular {
    position: relative;
    z-index: 1;
    background: #fdfdfd; /* Fondo base del contenido */
    border: 1px solid #653A00;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.2);
}

.marco-carta-espectacular::before {
    content: '';
    position: absolute;
    top: -8px; 
    left: -8px;
    right: -8px;
    bottom: -8px;
    z-index: -2;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    filter: blur(10px);
    opacity: 0.8;
    border-radius: 20px; /* Redondeo del resplandor */
}

.marco-carta-espectacular::after {
    content: '';
    position: absolute;
    top: -5px; 
    left: -5px;
    right: -5px;
    bottom: -5px;
    z-index: -1;
    background: linear-gradient(to bottom, #FFF8E1, #FFD54F);
    border-radius: 16px;
    box-shadow: inset 0 0 3px rgba(0,0,0,0.3);
}

/* ============================================= */
/* --- ANIMACIONES PARA MODALES --- */
/* ============================================= */

/* Animación para ABRIR el modal */
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5); /* Empieza a la mitad de su tamaño */
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1); /* Termina en su tamaño normal */
  }
}

/* Animación para CERRAR el modal (falta cambiar el scripts, pero no tengo ganas, asi que se deja con cierre normal) 

@keyframes zoomOut {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
}
.modal-content.is-closing {
  animation: zoomOut 0.3s ease-in forwards;
}
*/

/* EN styles.css (al final del archivo) */

.unit-members-pro {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background: #34495e; /* Mismo color que el contenedor de habilidad */
    border-top: 1px solid #46627f;
}

.unit-member-pro {
    text-align: center;
    background: #2c3e50; /* Mismo color de fondo principal del modal */
    padding: 8px;
    border-radius: 4px;
    flex: 1;
}

.unit-member-pro span {
    display: block;
}

.unit-member-role {
    font-size: 0.7em;
    color: #f39c12; /* Color anaranjado para el rol */
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.unit-member-name {
    font-size: 0.9em;
    color: #ecf0f1;
}

/*
.ability-title-pro span.special-move-tag {
    background: #9b59b6;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    margin-right: 8px;
}
*/

/* ======================================================= */
/* --- FONDOS DINÁMICOS PARA ETIQUETAS DE HABILIDAD --- */
/* ======================================================= */

.tag-bg-hero {
    background-color: #c0392b !important; /* Rojo para Hero */
}
.tag-bg-elite {
    background-color: #2980b9 !important; /* Azul para Elite */
}
.tag-bg-berserker {
    background-color: #8e44ad !important; /* Morado para Berserker */
}
.tag-bg-special {
    background-color: #208f4f !important; /* Verde #2ecc71 para Special CP */
}
.tag-bg-default {
    background-color: #3498db !important; /* Azul por defecto */
}

/* ===================================================================
   --- ESTILOS ESPECÍFICOS PARA MODAL DE PELÍCULAS (mymovies.php) ---
   =================================================================== */

/* (Request 1) Layout principal del modal de película (imagen izq, info der) */
/* Esta clase es NUEVA y solo la usarán las películas */
.movie-detail-layout {
    display: flex;
    flex-direction: row; /* Layout horizontal */
    flex-wrap: wrap;     
    align-items: flex-start; /* Alinea arriba (esto soluciona tu Request 1) */
    gap: 20px;
}

/* Contenedor de la imagen/carrusel de la película */
.movie-detail-layout .movie-detail-image {
    flex: 0 0 250px; /* Tamaño fijo para la imagen/carrusel */
    max-width: 250px;
    /* Reseteamos cualquier margen que pueda heredar */
    margin: 0;
}

/* Contenedor de la información de la película */
.movie-detail-layout .movie-detail-info {
    flex: 1; /* Ocupa el resto del espacio */
    min-width: 300px; /* Para que se ajuste bien al hacer wrap */
}

/* (Request 2) Rejilla para los metadatos en 2 columnas */
/* Esta clase también es NUEVA */
.movie-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 5px 15px; /* Espacio entre filas y columnas */
    background-color: rgba(0,0,0,0.05);
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
}

.movie-details-grid span {
    font-size: 0.9em;
}
/* ===================================================================
   --- ESTILOS ESPECÍFICOS PARA MODAL DE JUEGOS (mygames.php) ---
   =================================================================== */

/* Layout principal del modal de juego (imagen izq, info der) */
.game-detail-layout {
    display: flex;
    flex-direction: row; /* Layout horizontal */
    flex-wrap: wrap;
    align-items: flex-start; /* Alinea arriba, no al centro */
    gap: 20px;
}

/* Contenedor de la imagen del juego */
.game-detail-layout .game-detail-image {
    flex: 0 0 250px; /* Tamaño fijo para la imagen */
    max-width: 250px;
    margin: 0; /* Resetea márgenes */
}
.game-detail-layout .game-detail-image img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 5px; /* Opcional: bordes redondeados */
}


/* Contenedor de la información del juego */
.game-detail-layout .game-detail-info {
    flex: 1; /* Ocupa el resto del espacio */
    min-width: 300px; /* Para que se ajuste bien al hacer wrap */
}

/* Estilos para la sección 'details' dentro del modal de juego (opcional) */
.game-detail-layout .game-detail-info .details {
    background-color: rgba(0,0,0,0.05);
    border-radius: 4px;
    padding: 0px;
    margin: 10px 0;
}
.game-detail-layout .game-detail-info .details strong {
    min-width: 60px; /* Alinea un poco los títulos */
    display: inline-block;
}

/* ================================================================
   --- ESTILOS NUEVOS: GESTIÓN DE COCHES / MARCAS (NO TOCAR ANTERIORES) ---
   ================================================================ */

/* Contenedor flexible para formularios horizontales (Marcas, Relaciones) */
.kdp-manage-form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end; /* Alinea la parte baja de los inputs y el botón */
    flex-wrap: wrap;
    width: 100%;
}

/* Grupo Label + Input vertical */
.kdp-form-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column; /* Asegura que el Label quede siempre ARRIBA */
}

/* Estilo para el Label dentro de estos formularios */
.kdp-form-group label {
    margin-bottom: 6px;
    font-weight: bold;
    display: block;
    font-size: 0.9em;
    color: #333;
}

/* TRUCO: Forzar al input file a parecerse al input text */
.kdp-form-group input[type="file"] {
    border: 1px solid #ccc;
    background-color: #fff;
    padding: 6px;       /* Padding para dar aire */
    border-radius: 4px;
    width: 100%;
    height: 35px;       /* ALTURA FIJA: La clave para que se alinee con el input text */
    box-sizing: border-box;
    font-size: 0.9em;
    display: flex;      
    align-items: center; /* Centra el texto "Elegir archivo" verticalmente */
}

/* Si hay una imagen pequeña de vista previa */
.kdp-mini-preview {
    height: 33px;
    width: auto;
    margin-left: 10px;
    vertical-align: bottom;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1px;
    background: #fff;
}

/* --- FIX TARJETAS COCHES (Título y Logo) --- */
.car-card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Espacio entre logo y texto */
    margin: 8px 0;
    min-height: 3em; /* Altura mínima para alineación */
}

.car-card-logo {
    flex-shrink: 0; /* Que el logo no se aplaste */
    height: 24px;
    width: auto;
    max-width: 40px;
    object-fit: contain;
}

.car-card-title {
    font-size: 1em;
    margin: 0;
    color: #d35400;
    line-height: 1.2;
    /* Técnica para limitar a 2 líneas y poner puntos suspensivos si se pasa */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.4em; /* 1.2 line-height * 2 líneas */
}

/* =======================================================
   FIX FINAL: COCHES (METADATOS Y MÓVIL)
   ======================================================= */

/* 1. ARREGLO DE EAN/REF CORTADOS (Escritorio y Móvil) */
.car-meta-grid {
    background: #fff3e0;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #ffe0b2;
    /* Magia Flexbox: */
    display: flex;
    flex-wrap: wrap; /* Si no caben, bajan a la siguiente línea */
    gap: 10px 20px;  /* Espacio entre elementos */
    font-size: 0.95em;
}

.car-meta-item {
    white-space: nowrap; /* IMPIDE que "Ref: 123" se parta en dos líneas */
    display: flex;
    gap: 5px;
}

/* =======================================================
   FIX ULTIMATE V2: CENTRADO DE MODAL EN MÓVIL
   ======================================================= */
@media (max-width: 768px) {
    
    #detailCarModal .detail-modal-content {
        /* Resetear posicionamiento de escritorio */
        position: relative !important; 
        left: 0 !important;  /* <--- ESTO ES LO QUE FALTABA PARA QUE NO SE VAYA A LA DERECHA */
        top: 0 !important;
        transform: none !important;
        
        /* Ajustar tamaño y margenes */
        width: 95% !important;
        max-width: 95% !important;
        margin: 20px auto !important; /* Auto centra horizontalmente */
        max-height: 85vh !important;
        
        /* Cambiar layout a vertical */
        display: flex !important;
        flex-direction: column !important;
        padding: 15px !important;
    }

    /* Romper el grid interno */
    #detailCarModal #detailModalBody {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        gap: 15px !important;
    }

    /* Ajustar imagen */
    #detailCarModal .carousel-container {
        height: auto !important;
        min-height: 200px !important;
        background: #fff !important; 
        border: none;
    }

    #detailCarModal .carousel-track img {
        max-height: 220px !important;
        object-fit: contain !important;
        margin: 0 auto;
    }
    
    /* Ajustar info */
    #detailCarModal .info {
        width: 100% !important;
        padding-right: 0 !important;
        max-height: none !important; /* Permitir que crezca */
    }
}