/* ============================================
   SISTEMA DE INVENTARIO - NEON GLASSMORPHISM
   ============================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: url('Diseño.png') no-repeat top center fixed;
    background-color: #f4f7fa;
    background-size: 100% 100%;
    color: #333;
    margin: 0;
    padding: 0;
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 295px; /* Push down an additional 2cm (approx 75px) to avoid covering the ZET WORLD logo */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

.floating-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    z-index: 1000;
}

/* Vector Illustration Style Containers */
.header-title, .form-section, .modal-content {
    background-color: rgba(255, 255, 255, 0.95);
    border: 3px solid #14464d; /* Dark teal outline to match background */
    border-radius: 16px;
    box-shadow: 8px 8px 0px rgba(20, 70, 77, 0.3); /* Flat offset shadow */
    margin-bottom: 30px;
    color: #14464d;
    transition: all 0.2s ease;
}

.form-section:hover, .modal-content:hover {
    box-shadow: 10px 10px 0px rgba(20, 70, 77, 0.4);
}

/* Mover 5.4cm a la izquierda (aprox 206px) ya está en HTML */
.header-title, .form-section {
}

.header-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
}

.form-section {
    padding: 35px;
    width: 100%;
    max-width: 1000px;
}

.header-title h2 { margin: 0; color: #14464d; font-weight: 700; font-size: 24px; text-shadow: none;}

.form-section h4 {
    margin-top: 0;
    color: #254a7c;
    font-size: 22px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 15px;
    margin-bottom: 25px;
    text-shadow: none;
}

/* Grillas de formularios */
.form-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

.form-grid .form-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 150px;
}

.form-group label {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #14464d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Inputs y Selects */
input, select {
    padding: 14px;
    border: 2px solid #14464d;
    border-radius: 8px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background-color: #fff;
    color: #14464d;
    font-size: 15px;
    font-weight: 600;
}

input:focus, select:focus {
    outline: none;
    border-color: #d68b2a;
    box-shadow: 4px 4px 0px rgba(214, 139, 42, 0.2);
    transform: translate(-2px, -2px);
}

::placeholder {
    color: rgba(20, 70, 77, 0.4);
    font-weight: 500;
}

/* Inputs de Archivo (Foto) */
input[type="file"] {
    padding: 11px;
    cursor: pointer;
    color: #333;
}

/* Botones Flat Vector */
button, .btn-primary, .btn-danger {
    cursor: pointer;
    border: 2px solid #14464d;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 4px 4px 0px #14464d; /* Solid flat shadow */
}

button:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #14464d;
}

button:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0px #14464d;
}

.btn-primary { 
    background-color: #3b82f6; /* Bright Blue */
    color: #fff;
}

.btn-success { 
    background-color: #10b981; /* Emerald Green */
    color: #fff;
}

.btn-warning { 
    background-color: #d68b2a; /* Gold/Orange */
    color: #fff;
}

.btn-danger { 
    background-color: #ef4444; /* Bright Red */
    color: #fff;
}

.btn-delete { 
    background-color: #fee2e2; 
    color: #ef4444; 
    border: 2px solid #ef4444; 
    padding: 8px 12px; 
    font-size: 12px; 
    text-transform: none;
    box-shadow: 2px 2px 0px #ef4444;
}
.btn-delete:hover { 
    background-color: #ef4444; 
    color: #fff; 
    transform: translate(-1px, -1px); 
    box-shadow: 3px 3px 0px #7f1d1d;
}

/* Buscador */
.search-input {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    margin-bottom: 25px;
    background-color: #fff;
    border: 3px solid #14464d;
    color: #14464d;
    border-radius: 12px;
    box-shadow: 4px 4px 0px rgba(20, 70, 77, 0.2);
}

/* Tablas estilo Flat Vector */
.table-container {
    max-height: 50vh;
    overflow-y: auto;
    margin-top: 10px;
    border-radius: 12px;
    padding: 0;
    background: #fff;
    border: 3px solid #14464d;
    box-shadow: 6px 6px 0px rgba(20, 70, 77, 0.2);
}

.db-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
}

.db-table th, .db-table td {
    border-bottom: 2px solid rgba(20, 70, 77, 0.1);
    padding: 18px 15px;
    text-align: left;
}

.db-table td {
    color: #111;
    font-size: 14px;
}

.db-table th {
    background-color: #f4f7fa;
    color: #14464d;
    font-weight: 800;
    position: sticky;
    top: 0;
    z-index: 10;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 1px;
    border-bottom: 3px solid #14464d;
}

.db-table tbody tr {
    transition: all 0.2s ease;
}
.db-table tbody tr:hover { 
    background-color: #eaf3f5; 
}

/* Previsualización de imagen */
.img-preview {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(0,255,255,0.4);
    box-shadow: 0 0 10px rgba(0,255,255,0.2);
    cursor: pointer;
    transition: all 0.3s;
}
.img-preview:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0,255,255,0.6);
}

/* Modal de imagen grande */
#modal-img {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}
#modal-img img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0,255,255,0.4);
    border: 1px solid rgba(0,255,255,0.2);
}

/* Modales Generales */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,5,10,0.85);
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    padding: 40px;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.close-modal {
    color: rgba(255,255,255,0.4);
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: none;
}
.close-modal:hover { 
    color: #ff416c; 
    text-shadow: 0 0 15px rgba(255,65,108,0.8);
    transform: rotate(90deg);
}

.mt-10 { margin-top: 10px; }
.mb-10 { margin-bottom: 10px; }
.red-text { color: #ff416c; text-shadow: 0 0 5px rgba(255,65,108,0.5); }

/* Impresión y PDF */
.only-print { display: none; }
.constancia-print-only { display: none; }

@media print {
    @page { margin: 0; }
    
    body {
        background: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .no-print { display: none !important; }
    .only-print { display: block !important; }
    .constancia-print-only { display: block !important; }
    
    .pdf-watermark {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw !important;
        height: 100vh !important;
        z-index: -100;
        object-fit: cover;
        opacity: 0.15; /* Transparent background for readability */
    }

    .modal-overlay {
        position: static !important;
        display: block !important;
        background: transparent !important;
        backdrop-filter: none !important;
    }
    .modal-content {
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        color: black !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 1.5cm !important;
    }
    .table-container {
        max-height: none !important;
        overflow: visible !important;
        border: none !important;
        box-shadow: none !important;
    }
    .db-table th {
        background-color: rgba(255, 255, 255, 0.4) !important;
        color: #111 !important;
        border-bottom: 2px solid rgba(0, 0, 0, 0.5) !important;
        box-shadow: none !important;
    }
    .db-table td {
        border-bottom: 1px solid rgba(0, 0, 0, 0.2) !important;
        color: #000 !important;
        background-color: transparent !important;
    }
}

/* Custom layout for desktop aligned to background */
.form-and-button-wrapper.desktop-shifted {
    position: relative;
    left: -206px;
    width: 100%;
    max-width: 1000px;
}
.lateral-buttons {
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 78px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
}

/* Responsive adjustment for mobile screens */
@media screen and (max-width: 800px) {
    body {
        background: url('solar_bg.png') no-repeat center center fixed !important;
        background-size: cover !important;
    }
    .main-container {
        padding-top: 50px !important;
    }
    .form-section, .modal-content {
        background-color: rgba(255, 255, 255, 0.85) !important;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255,255,255,0.6) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
        border-radius: 20px !important;
    }
    .form-section label, .form-section h4 {
        color: #14464d !important;
        text-shadow: none !important;
    }
    .modal-content {
        padding: 20px !important;
    }
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .db-table {
        min-width: 700px;
    }
    .form-and-button-wrapper.desktop-shifted {
        left: 0 !important;
    }
    .lateral-buttons {
        position: static !important;
        margin-left: 0 !important;
        margin-top: 20px !important;
    }
}

/* Floating controls (Sync Status, Back button) */
.floating-controls {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

/* Modal Login de Seguridad */
#login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    text-align: center;
    max-width: 400px;
    width: 90%;
    border-top: 5px solid #dc3545;
}

.login-box h2 {
    color: #dc3545;
    margin-top: 0;
    margin-bottom: 15px;
}

.login-box p {
    color: #333;
    font-size: 14px;
    margin-bottom: 25px;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.login-box input:focus {
    border-color: #dc3545;
    outline: none;
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.3);
}

.login-box button {
    width: 100%;
    padding: 14px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-box button:hover {
    background-color: #c82333;
}

/* ====== FORMATO DE IMPRESIÓN PARA CONSTANCIA DE BODEGA ====== */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    body {
        background-color: #fff !important;
        color: #000 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    #print-constancia-container {
        display: block !important;
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
        min-height: auto !important;
        box-sizing: border-box;
    }
    
    #print-constancia-container table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-top: 20px !important;
        margin-bottom: 40px !important;
    }
    
    #print-constancia-container th, 
    #print-constancia-container td {
        border: 1px solid #14464d !important;
        padding: 12px !important;
        font-size: 13px !important;
        color: #000 !important;
        text-align: left !important;
        background-color: transparent !important;
    }
    
    #print-constancia-container th {
        background-color: #eaf3f5 !important;
        font-weight: bold !important;
        text-transform: uppercase !important;
    }
    
    /* Reglas para saltos de página limpios */
    #print-constancia-container tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    #print-constancia-container thead {
        display: table-header-group !important;
    }
    
    .firmas-container {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
}