﻿/* =========================================
   RESET
========================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================================
   BODY
========================================= */

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #eef2f7;
    color: #1e293b;
    display: flex;
    min-height: 100vh;
}

/* =========================================
   SIDEBAR
========================================= */

.sidebar {
    width: 280px;
    background: linear-gradient( 180deg, #07122b, #0d1b3d );
    color: white;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* =========================================
   LOGO
========================================= */

.logo {
    font-size: 30px;
    font-weight: bold;
}

/* =========================================
   USUARIO
========================================= */

.usuario-card {
    background: rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: white;
    color: #07122b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

#nombreUsuarioSidebar {
    font-size: 18px;
    font-weight: bold;
}

.dni-text {
    font-size: 14px;
    opacity: 0.8;
}

/* =========================================
   MENU
========================================= */

.menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-btn {
    border: none;
    background: transparent;
    color: white;
    text-align: left;
    padding: 16px 18px;
    border-radius: 14px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
}

    .menu-btn:hover {
        background: rgba(255,255,255,0.08);
    }

    .menu-btn.active {
        background: rgba(255,255,255,0.14);
    }

.logout {
    margin-top: 20px;
    color: #ffb4b4;
}

/* =========================================
   MAIN
========================================= */

.main-content {
    flex: 1;
    padding: 26px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* =========================================
   TOPBAR
========================================= */

.topbar {
    background: white;
    border-radius: 24px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

    .topbar h1 {
        font-size: 42px;
        margin-bottom: 8px;
    }

    .topbar p {
        color: #64748b;
        font-size: 18px;
    }

/* =========================================
   BOTON SALIR
========================================= */

.btn-salir {
    background: #16a34a;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 16px;
    cursor: pointer;
}

/* =========================================
   SEARCH
========================================= */

.search-box {
    background: white;
    border-radius: 24px;
    padding: 20px;
    display: flex;
    gap: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

    .search-box input {
        flex: 1;
        border: 1px solid #dbe3ef;
        border-radius: 14px;
        padding: 18px;
        font-size: 16px;
    }

    .search-box button {
        background: #2563eb;
        color: white;
        border: none;
        border-radius: 14px;
        padding: 0 28px;
        font-size: 16px;
        cursor: pointer;
    }

/* =========================================
   ACTIONS
========================================= */

.actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.action-btn {
    border: none;
    border-radius: 22px;
    padding: 26px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 140px;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 10px 25px rgba(0,0,0,.08);
}

    .action-btn:hover {
        transform: translateY(-4px);
        box-shadow: 0 15px 35px rgba(0,0,0,.15);
    }

.blue {
    background: linear-gradient(135deg,#2563eb,#1d4ed8);
}

.green {
    background: linear-gradient(135deg,#16a34a,#15803d);
}

.cyan {
    background: linear-gradient(135deg,#06b6d4,#0891b2);
}

.aqua {
    background: linear-gradient(135deg,#2dd4bf,#0f766e);
}

.red {
    background: linear-gradient(135deg,#ef4444,#dc2626);
}

.brown {
    background: linear-gradient(135deg,#c19a6b,#a47551);
}

/* =========================================
   PEDIDOS
========================================= */

.pedidos-section {
    background: white;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

    .pedidos-section h2 {
        margin-bottom: 24px;
    }

.pedidos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* =========================================
   PEDIDO CARD
========================================= */



.pedido-farmacia {
    margin-top: 6px;
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.pedido-top {
    display: flex;
    justify-content: space-between;
}

.pedido-id {
    color: #7c3aed;
    font-weight: bold;
}

.pedido-farmacia {
    margin-top: 8px;
    color: #444;
    font-size: 14px;
    font-weight: 600;
}

.pedido-estado {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    background: linear-gradient( 135deg, #2dd4bf, #14b8a6 );
    box-shadow: 0 4px 10px rgba( 20, 184, 166, .25 );
}

.pedido-fecha {
    margin-top: 8px;
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
}

.pedido-total {
    margin-top: 12px;
    font-size: 20px;
    font-weight: bold;
    color: #15803d;
}

.pedido-info-extra {
    margin-top: 8px;
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
}


/* =========================================
   BOTON CANCELAR
========================================= */

.btn-cancelar {
    background: #ef4444;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: bold;
}

/* =========================================
   MOBILE
========================================= */

@media(max-width: 768px) {

    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 18px;
    }

    .menu {
        flex-direction: row;
        overflow-x: auto;
    }

    .menu-btn {
        white-space: nowrap;
    }

    .main-content {
        padding: 18px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
    }

        .topbar h1 {
            font-size: 32px;
        }

    .search-box {
        flex-direction: column;
    }

        .search-box button {
            width: 100%;
            height: 58px;
        }

    .actions-grid {
        grid-template-columns: repeat(2,1fr);
    }

    .action-btn {
        min-height: 120px;
        font-size: 16px;
    }

    .pedidos-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   LOGIN APOTEQ
========================================= */

.login-body {
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient( 135deg, #0c7f99, #18b3aa );
    font-family: Arial, Helvetica, sans-serif;
}

.login-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    width: 100%;
    max-width: 520px;
    background: white;
    border-radius: 28px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,.20);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.logo-login {
    text-align: center;
    margin-bottom: 10px;
}

.logo-apoteq {
    width: 100%;
    max-width: 180px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.login-card h1 {
    font-size: 34px;
    color: #1f2937;
    text-align: center;
    margin-top: 10px;
}

.subtitulo-login {
    text-align: center;
    color: #64748b;
    font-size: 16px;
    margin-bottom: 10px;
}

.login-card p {
    text-align: center;
    color: #64748b;
    font-size: 15px;
}

.login-card input {
    height: 58px;
    border: 1px solid #dbe3ef;
    border-radius: 16px;
    padding: 0 18px;
    font-size: 17px;
    outline: none;
    transition: .2s;
}

    .login-card input:focus {
        border-color: #18b3aa;
        box-shadow: 0 0 0 4px rgba(24,179,170,.15);
    }

.login-card button {
    height: 58px;
    border: none;
    border-radius: 16px;
    background: linear-gradient( 135deg, #0c7f99, #18b3aa );
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: .2s;
}

    .login-card button:hover {
        transform: translateY(-2px);
    }

    .login-card button:active {
        transform: translateY(0);
    }

#panelRegistro {
    display: none;
    flex-direction: column;
    gap: 14px;
    margin-top: 10px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

/* =========================================
   RESPONSIVE LOGIN
========================================= */

@media(max-width:768px) {

    .login-card {
        padding: 30px 24px;
    }

    .logo-apoteq {
        max-width: 180px;
    }

    .login-card h1 {
        font-size: 28px;
    }
}

/* =========================================
   DIRECCIONES
========================================= */

.direccion-card {
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: white;
    transition: 0.3s;
}

    .direccion-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    }

.direccion-principal {
    border: 2px solid #16a34a;
}

.direccion-alias {
    font-size: 22px;
    font-weight: bold;
    color: #07122b;
}

.direccion-texto {
    color: #64748b;
    line-height: 1.5;
}

.direccion-botones {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

/* =========================================
   BADGES
========================================= */

.direccion-badge {
    display: inline-block;
    background: #dcfce7;
    color: #166534;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
}

.direccion-badge-ultima {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
}

/* =========================================
   BOTONES
========================================= */

.btn-direccion {
    border: none;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    transition: 0.3s;
}

    .btn-direccion:hover {
        transform: translateY(-2px);
    }

.btn-seleccionar {
    background: linear-gradient( 135deg, #16a34a, #15803d );
}

.btn-predeterminada {
    background: linear-gradient( 135deg, #2563eb, #1d4ed8 );
}

.btn-eliminar {
    background: linear-gradient( 135deg, #ef4444, #dc2626 );
}

/* =========================================
   MOBILE
========================================= */

@media(max-width:768px) {

    .direccion-botones {
        flex-direction: column;
    }

    .btn-direccion {
        width: 100%;
    }
}

/* =========================================
   FORMULARIOS
========================================= */

.form-direccion {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .form-row label {
        font-weight: bold;
        color: #07122b;
    }

    .form-row input {
        border: 1px solid #dbe3ef;
        border-radius: 14px;
        padding: 14px;
        font-size: 16px;
    }

.form-direccion-card {
    background: white;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 10px 30px rgba(0,0,0,.05);
}

.form-row input {
    height: 52px;
    border-radius: 14px;
    border: 1px solid #dbe3ef;
    padding: 0 14px;
}
.form-row input:focus {

    outline: none;

    border-color: #18b3aa;

    box-shadow:
        0 0 0 4px
        rgba(24,179,170,.15);
}
.btn-guardar-direccion {
    width: 100%;
    height: 58px;
    border: none;
    border-radius: 16px;
    background: linear-gradient( 135deg, #16a34a, #15803d );
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

.btn-guardar-direccion {
    width: 100%;
    height: 58px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg,#16a34a,#15803d);
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

.btn-guardar-direccion:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(22,163,74,.25);
}

.btn-guardar-direccion:active {
    transform: translateY(0);
}

/* =========================================
   GRID DIRECCIONES
========================================= */

.direcciones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px,1fr));
    gap: 20px;
}

#direccionSeleccionadaCard {
    margin-top: 20px;
}

#listaResultados {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pedido-acciones {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-detalle,
.btn-cancelar,
.btn-repetir {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    font-weight: 600;
}

.btn-detalle {
    background: #2563eb;
    color: white;
}

.btn-cancelar {
    background: #dc2626;
    color: white;
}

.btn-repetir {
    background: #16a34a;
    color: white;
}

/* ========================================= */
/* MODAL */
/* ========================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 5px 20px rgba(0,0,0,.25);
}

    .modal-content h3 {
        margin-top: 0;
    }

    .modal-content select {
        width: 100%;
        padding: 10px;
        margin-top: 10px;
        margin-bottom: 20px;
        border-radius: 8px;
    }

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ===================================== */
/* BOTON VOLVER */
/* ===================================== */

.btn-volver-green {
    background: linear-gradient( 135deg, #16a34a, #15803d );
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-weight: 700;
    cursor: pointer;
    transition: .3s;
}

    .btn-volver-green:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(22,163,74,.25);
    }

/* ==========================
   FARMACIA SELECCIONADA
   ========================== */

.farmacia-seleccionada {
    margin-top: 12px;
    padding: 14px;
    border-radius: 12px;
    background: #f4f9ff;
    border-left: 5px solid #1f4e79;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1f4e79;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.farmacia-card {
    margin-bottom: 20px;
}

/* =========================================
   TABS LOGIN
========================================= */

.tipo-acceso {
    display: flex;
    width: 100%;
    margin: 20px 0 25px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #eef2ff;
    border: 1px solid #dbeafe;
}

    .tipo-acceso button {
        flex: 1;
        border: none;
        padding: 14px;
        cursor: pointer;
        font-size: 15px;
        font-weight: 600;
        background: transparent;
        color: #475569;
        transition: all 0.2s ease;
    }

    .tipo-acceso button.activo {
        background: #0ea5b7;
        color: white;
    }

/* =========================================
   CENTRAR BOTONES DIRECCIONES
========================================= */
.actions-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.direccion-botones {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

#btnGuardar:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* =========================================
MODAL DIRECCIONES
========================================= */

.modal-direcciones {
    width: 95%;
    max-width: 850px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 20px;
   
}

/* HEADER */

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
    
}

    .modal-header h3 {
        margin: 0;
        color: #0f172a;
        font-size: 24px;
       
    }

/* RESULTADOS */

/* Overlay más suave */
.modal-overlay {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
}

/* Modal blanco */
.modal-content {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0,0,0,.20);
}

/* Tarjetas */
.resultado-direccion {
    background: #f8fafc;
    border: 2px solid #dbeafe;
    border-radius: 18px;
    padding: 20px;
    transition: .25s;
}

    .resultado-direccion:hover {
        border-color: #14b8a6;
        transform: translateY(-2px);
    }

/* Texto */
.resultado-direccion-texto {
    color: #1e293b;
    font-size: 15px;
    line-height: 1.6;
}

/* Botón Seleccionar */
.btn-seleccionar-direccion {
    background: linear-gradient( 135deg, #2dd4bf, #14b8a6 );
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(20,184,166,.25);
    transition: .25s;
}

    .btn-seleccionar-direccion:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 25px rgba(20,184,166,.35);
    }

    .btn-seleccionar-direccion:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(20,184,166,.25);
       
    }

/* MENSAJE DE DIRECCION VALIDADA */

#direccionSeleccionadaCard {
    margin-top: 20px;
    background: #ecfdf5;
    border: 1px solid #10b981;
    border-radius: 16px;
    padding: 20px;
    color: #065f46;
   
}

    #direccionSeleccionadaCard strong {
       display: block;
        margin-bottom: 10px;
        font-size: 16px;
        
    }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =========================================
   NUEVA DIRECCION
========================================= */

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .form-row label {
        font-weight: 600;
        color: #334155;
    }

    .form-row input,
    .form-row select {
        padding: 12px;
        border: 1px solid #cbd5e1;
        border-radius: 12px;
        font-size: 14px;
    }

        .form-row input:focus,
        .form-row select:focus {
            outline: none;
            border-color: #14b8a6;
            box-shadow: 0 0 0 3px rgba(20,184,166,.15);
        }

@media (max-width:768px) {

    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* =====================================
   TELEFONO REGISTRO
===================================== */

.telefono-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

    .telefono-row input:first-child {
        width: 120px;
    }

    .telefono-row input:last-child {
        flex: 1;
    }

.telefono-help {
    display: block;
    margin-bottom: 15px;
    color: #64748b;
    font-size: 13px;
}

/* =========================================
   CLASE HIDDEN
========================================= */

.hidden {
    display: none !important;
}