:root {
    --primary: #8a2be2;
    --primary-light: #a052ee;
    --accent: #00f2ff;
    --bg-dark: #0a0a0c;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --text-muted: #a0a0a0;
    --success: #00ff88;
    --error: #ff4b4b;
    --warning: #ffcc00;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(138, 43, 226, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 242, 255, 0.05) 0%, transparent 40%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Utils */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(138, 43, 226, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: var(--glass);
}

.btn-icon {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-group input, 
.input-group select {
    width: 100%;
    padding: 14px 14px 14px 45px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--primary);
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Views */
.view {
    display: none;
    min-height: 100vh;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* Login Screen */
#login-screen {
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-glass {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

.brand {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.brand i {
    color: var(--primary);
}

.brand span span {
    color: var(--primary);
}

.login-glass h2 {
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.login-glass p {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.9rem;
}

/* Dashboard Screen */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background: rgba(10, 10, 12, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand i {
    color: var(--primary);
}

.nav-brand span span {
    color: var(--primary);
}

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

.nav-user span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.content {
    padding: 40px 5%;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.header-info h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.header-info p {
    color: var(--text-muted);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 25px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-icon.purple { background: rgba(138, 43, 226, 0.2); color: var(--primary-light); }
.stat-icon.red { background: rgba(255, 75, 75, 0.2); color: var(--error); }
.stat-icon.blue { background: rgba(0, 242, 255, 0.2); color: var(--accent); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
}

/* Table */
.table-container {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

th {
    text-align: left;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 400;
    border-bottom: 1px solid var(--glass-border);
}

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

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

.service-badge {
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-weight: 600;
    margin-top: 10px;
}

.login-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.login-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255,255,255,0.1);
}

.login-divider span {
    background: #0f172a;
    padding: 0 10px;
    position: relative;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-google {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-google:hover {
    background: rgba(255,255,255,0.1);
}

.btn-google img {
    width: 18px;
}

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

.client-phone {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.expiry-days {
    font-size: 0.85rem;
}

.status-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-tag.active { background: rgba(0, 255, 136, 0.1); color: var(--success); }
.status-tag.warning { background: rgba(255, 204, 0, 0.1); color: var(--warning); }
.status-tag.expired { background: rgba(255, 75, 75, 0.1); color: var(--error); }
.status-tag.lank { background: rgba(0, 242, 255, 0.1); color: var(--accent); }

.action-btns {
    display: flex;
    gap: 10px;
}

.btn-whatsapp {
    color: var(--success);
    background: rgba(0, 255, 136, 0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.btn-whatsapp:hover {
    background: var(--success);
    color: black;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-glass {
    background: #121216;
    border: 1px solid var(--glass-border);
    padding: 30px;
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

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

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}

/* Toggle Switch */
.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-top: 10px;
}

.toggle input {
    display: none;
}

.slider {
    width: 40px;
    height: 20px;
    background: var(--glass);
    border-radius: 20px;
    position: relative;
    transition: 0.3s;
    border: 1px solid var(--glass-border);
}

.slider:before {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: 0.3s;
}

input:checked + .slider {
    background: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- DISEÑO MÓVIL CRÍTICO (SIN SCROLL LATERAL) --- */
@media (max-width: 768px) {
    html, body {
        width: 100%;
        overflow-x: hidden;
        position: relative;
    }

    .content {
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    table {
        min-width: auto !important; /* ELIMINAR EL ANCHO MÍNIMO */
        width: 100% !important;
    }

    .table-container {
        background: transparent;
        border: none;
        backdrop-filter: none;
        box-shadow: none;
        width: 100% !important;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }

    table, thead, tbody, th, td, tr {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
    }

    thead {
        display: none;
    }

    tr {
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 16px;
        margin-bottom: 15px;
        padding: 15px;
        width: 100% !important;
    }

    td {
        padding: 10px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none !important;
        color: white; /* Asegurar que el valor se vea */
    }

    td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.7rem;
        text-transform: uppercase;
        margin-right: 10px;
    }

    /* Valores a la derecha */
    .client-info, .expiry-info {
        text-align: right;
        align-items: flex-end;
    }

    /* Servicio y Badge */
    td:first-child {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        margin-bottom: 10px;
        padding-bottom: 12px;
    }

    /* Acciones */
    .action-btns {
        width: 100%;
        justify-content: center;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        gap: 15px;
    }

    .btn-whatsapp, .btn-icon {
        flex: 1;
        height: 44px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.07);
        font-size: 1.2rem;
    }

    .btn-whatsapp {
        background: rgba(37, 211, 102, 0.2);
        color: #25d366;
    }
}
