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

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Inter", "Segoe UI", sans-serif;
}

body {
    background: linear-gradient(180deg, #1c2126 0%, #151a1f 100%);
    color: #e6edf3;
    padding: 20px;
}

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

/* ================= HEADER ================= */

.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 40px;
    text-align: center;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: #4da3ff;
}

.sublogo {
    font-size: 13px;
    color: #8b949e;
    margin-top: 5px;
    margin-bottom: 18px;
}

.nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav a {
    background: #2a3138;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #e6edf3;
    font-size: 14px;
    transition: 0.2s;
}

.nav a:hover {
    background: #4da3ff;
    color: #000;
}

/* ================= FOOTER ================= */

.footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid #30363d;
    text-align: center;
    font-size: 13px;
    color: #8b949e;
}

/* ================= DASHBOARD ================= */

/* ================= DASHBOARD ================= */

.dash-title {
    margin-bottom: 25px;
    font-size: 22px;
}

/* ===== Metrics ===== */

.metrics-wrapper {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    font-size: 14px;
    color: #8b949e;
    flex-wrap: wrap;
}

.metrics-wrapper strong {
    color: #4da3ff;
    font-weight: 600;
    margin-left: 6px;
}

/* ===== Table Wrapper (scroll horizontal móvil) ===== */

.installations-wrapper {
    overflow-x: auto;
    border: 1px solid #30363d;
    border-radius: 14px;
}

/* Header */

.desktop-head {
    display: grid;
    grid-template-columns: 220px 220px 120px 150px 160px;
    padding: 14px 20px;
    font-size: 13px;
    color: #8b949e;
    border-bottom: 1px solid #30363d;
    min-width: 850px;
}

/* Rows */

.installation-row {
    display: grid;
    grid-template-columns: 220px 220px 120px 150px 160px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #2a3138;
    cursor: pointer;
    transition: 0.2s;
    min-width: 850px;
}

.installation-row:hover {
    background: rgba(255,255,255,0.03);
}

.col-client {
    display: flex;
    flex-direction: column;
}

.installation-name {
    font-weight: 600;
    font-size: 15px;
}

.installation-info {
    font-size: 13px;
    color: #8b949e;
}

.installation-money {
    color: #4da3ff;
    font-weight: 600;
}

/* Buttons */

.installation-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.mini-btn {
    background: #2a3138;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    text-decoration: none;
    color: #e6edf3;
    transition: 0.2s;
}

.mini-btn:hover {
    background: #4da3ff;
    color: #000;
}

.mini-btn.danger {
    background: #7f1d1d;
    color: #fff;
}

.mini-btn.danger:hover {
    background: #b91c1c;
}
/* ================= DESKTOP ================= */

@media (min-width: 900px) {

    .header {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }

    .metrics-wrapper {
        gap: 60px;
        font-size: 15px;
    }

    .installations-wrapper {
        border: 1px solid #30363d;
        border-radius: 14px;
        overflow: hidden;
    }

    .desktop-head {
        display: grid;
        grid-template-columns: 2fr 2fr 1fr 1fr auto;
        padding: 14px 25px;
        font-size: 13px;
        color: #8b949e;
        border-bottom: 1px solid #30363d;
    }

    .installation-row {
        display: grid;
        grid-template-columns: 2fr 2fr 1fr 1fr auto;
        align-items: center;
        padding: 18px 25px;
        gap: 20px;
    }

    .installation-actions {
        margin-top: 0;
        justify-content: flex-end;
    }
}
/* ================= LOGIN / FORM ================= */

.form-card {
    background: #222830;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    font-size: 13px;
    color: #8b949e;
    margin-bottom: 6px;
}

input {
    background: #1a1f25;
    border: 1px solid #30363d;
    color: #e6edf3;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    transition: 0.2s;
}

input:focus {
    border-color: #4da3ff;
    outline: none;
}

button {
    background: #4da3ff;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

button:hover {
    background: #2ecc71;
    color: #000;
}
/* ================= NUEVA INSTALACIÓN ================= */

.form-card {
    max-width: 720px;
    margin: 0 auto 40px auto;
}

/* GRID EN DESKTOP */
@media (min-width: 900px){

    .form-grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .form-group {
        display: flex;
        flex-direction: column;
    }
	
	.form-grid-2 .full-width {
        grid-column: 1 / -1;
    }
	
	.form-grid-2 button {
        grid-column: 1 / -1;
    }

    /* Campos que ocupan todo el ancho */
    .form-group.full-width {
        grid-column: 1 / -1;
    }

    textarea {
        grid-column: 1 / -1;
    }

    button {
        grid-column: 1 / -1;
    }
}

/* SELECT Y TEXTAREA */

select,
textarea {
    background: #1a1f25;
    border: 1px solid #30363d;
    color: #e6edf3;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    transition: 0.2s;
}

select:focus,
textarea:focus {
    border-color: #4da3ff;
    outline: none;
}

/* CHECKBOX BONITO */

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4da3ff;
}

/* BOTÓN MÁS LIMPIO */

button {
    margin-top: 10px;
    background: #4da3ff;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

button:hover {
    background: #2ecc71;
    color: #000;
}
/* ================= HEADER V2 ================= */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    position: relative;
}

.brand {
    display: flex;
    flex-direction: column;
}

.nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav a {
    background: #2a3138;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #e6edf3;
    font-size: 14px;
    transition: 0.2s;
}

.nav a:hover {
    background: #4da3ff;
    color: #000;
}

/* USER BADGE */

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1a1f25;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: #8b949e;
}

.user-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
}

/* BOTÓN SALIR */

.logout-link {
    background: #7f1d1d !important;
}

.logout-link:hover {
    background: #b91c1c !important;
    color: #fff !important;
}

/* MENU TOGGLE (MOBILE) */

.menu-toggle {
    display: none;
    background: #2a3138;
    border: none;
    color: #e6edf3;
    font-size: 18px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

/* ================= MOBILE ================= */

@media (max-width: 768px){

    .menu-toggle {
        display: block;
    }

    .nav {
        position: absolute;
        top: 75px;
        right: 15;
        background: #222830;
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        border-radius: 14px;
        gap: 14px;
        width: 240px;
        display: none;
        box-shadow: 0 20px 40px rgba(0,0,0,0.5);
		z-index: 1100;
    }

    .nav.nav-open {
        display: flex;
    }

    .nav a {
        width: 100%;
    }

    .user-badge {
        width: 100%;
        justify-content: flex-start;
    }
}

/* ================= MOBILE MENU FIX ================= */

@media (max-width: 768px){

    .nav {
        top: 85px;                 /* lo bajamos un poco */
        right: 15px;               /* no pegado al borde */
        width: 240px;              /* un poco más ancho */
        border: 1px solid #30363d;
        backdrop-filter: blur(12px);
        transform: translateY(-10px);
        opacity: 0;
        transition: all 0.25s ease;
    }

    .nav.nav-open {
        display: flex;
        transform: translateY(0);
        opacity: 1;
    }

    .menu-toggle {
        z-index: 1001;
    }

    /* Overlay fondo oscuro */
    .menu-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(4px);
        display: none;
        z-index: 1000;
    }

    .menu-overlay.active {
        display: block;
    }

}
/* FIX BOTÓN MENU */

.menu-toggle {
    background: #2a3138;
    color: #e6edf3;
    border: none;
    font-size: 18px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
    z-index: 1100;
}

.menu-toggle:hover {
    background: #4da3ff;
    color: #000;
}
/* ================= MOBILE TABLE SCROLL ================= */

@media (max-width: 768px){

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .crm-table {
        min-width: 700px;   /* fuerza scroll */
    }

}
/* ================= PAGINACIÓN ================= */

.installations-wrapper .pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-top: 1px solid #30363d;
    padding: 15px 25px;
    font-size: 13px;
    gap: 18px;
}

.page-link,
.page-link:visited,
.page-link:active,
.page-link:focus {
    color: #4da3ff;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    transition: 0.2s;
}

.page-link:hover {
    background: rgba(77,163,255,0.15);
}

.page-status {
    color: #8b949e;
    font-size: 13px;
}

/* ================= MOBILE ================= */

@media (max-width: 768px) {

    .installations-wrapper .pagination {
        justify-content: center;
        padding: 15px 20px;
    }

}
/* FIX REAL PAGINACIÓN */
.installations-wrapper .pagination {
    min-width: 0 !important;
    width: 100% !important;
}