﻿/* ================================================
   COMPONENTES REUTILIZABLES
   Header, Cards, Navegación, Botones, Modales
   ================================================ */

/* ===== HEADER ===== */
.header {
    background: rgba(0, 0, 0, 0.2);
    padding: max(15px, env(safe-area-inset-top, 15px)) 20px 15px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 1;
}

.header-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.header-spacer {
    width: 40px;
    min-width: 40px;
    flex-shrink: 0;
}

.logo {
    height: 32px;
    width: auto;
}

.header-title {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
}

@media (max-width: 480px) {
    .logo {
        height: 28px;
    }

    .header-title {
        font-size: 16px;
    }
}

/* ===== BACK BUTTON ===== */
.back-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
    text-decoration: none;
}

    .back-btn svg {
        width: 24px;
        height: 24px;
        stroke-width: 2;
    }

    .back-btn:hover {
        opacity: 0.8;
    }

    .back-btn:focus {
        outline: 2px solid white;
        outline-offset: 2px;
    }

/* ===== CARDS ===== */
.card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    margin: 0 20px 20px;
    color: white;
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .card-title svg {
        flex-shrink: 0;
    }

.card-content {
    font-size: 14px;
    line-height: 1.6;
    opacity: 0.9;
    margin: 0;
}

.card-meta {
    font-size: 13px;
    opacity: 0.8;
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .meta-item svg {
        flex-shrink: 0;
    }

/* ===== EMPTY STATE ===== */
.empty-card {
    text-align: center;
    padding: 40px 20px;
    color: white;
    opacity: 0.85;
}

.empty-icon {
    margin-bottom: 20px;
    opacity: 0.7;
}

    .empty-icon svg {
        width: 80px;
        height: 80px;
    }

.empty-text {
    font-size: 18px;
    opacity: 0.9;
    line-height: 1.6;
}

/* ===== SECTION TITLE ===== */
.section-title {
    font-size: 20px;
    font-weight: 500;
    color: white;
    margin: 25px 20px 15px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .section-title svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

/* ===== WELCOME SECTION ===== */
.welcome-section {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: clamp(24px, 5vh, 32px) clamp(20px, 5vw, 28px);
    margin: 0 20px 20px;
    color: white;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-name {
    font-size: clamp(28px, 7vw, 32px);
    font-weight: 600;
    margin-bottom: clamp(8px, 2vh, 12px);
    line-height: 1.2;
}

.welcome-text {
    font-size: clamp(15px, 3.8vw, 17px);
    opacity: 0.95;
    line-height: 1.6;
}

/* ===== CONTENT CONTAINER ===== */
.content {
    padding: clamp(18px, 4.5vw, 24px);
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

@media (max-width: 360px) {
    .content {
        padding: clamp(16px, 4vw, 20px);
    }
}

@media (min-width: 768px) {
    .content {
        padding: clamp(24px, 5vw, 32px);
    }
}

/* ===== CONTENT WRAPPER ===== */
.content-wrapper {
    flex: 1;
    min-height: 0;
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #f8f9fa;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    border-top: 1px solid rgba(0,0,0,0.06);
    padding-bottom: max(env(safe-area-inset-bottom), 10px);
    z-index: 999;
}
/* Cubrir el safe area inferior del iPhone con fondo sólido */
.bottom-nav::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-bottom, 0px);
    background: #f8f9fa;
    z-index: -1;
}

@media (min-width: 768px) {
    .bottom-nav {
        max-width: 768px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
    }
}

/* ===== NAV ITEMS ===== */
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #4a7ba7;
    padding: 5px 15px;
    transition: all 0.3s;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    min-width: 60px;
}

    .nav-item.active {
        color: #2d5a7b;
    }

        .nav-item.active .nav-text {
            font-weight: 600;
        }

    .nav-item:hover {
        color: #2d5a7b;
    }

.nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}

    .nav-icon svg {
        width: 100%;
        height: 100%;
        stroke-width: 2;
    }

.nav-text {
    font-size: 12px;
}

/* ===== BOTONES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #4a7ba7 0%, #5b8fb9 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 123, 167, 0.3);
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(74, 123, 167, 0.4);
    }

.btn-secondary {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
}

    .btn-secondary:hover {
        background: rgba(255, 255, 255, 0.35);
        border-color: rgba(255, 255, 255, 0.6);
        transform: translateY(-2px);
    }

.btn-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-circle svg {
        width: 24px;
        height: 24px;
    }

/* ===== BOTÓN REGISTRAR SET ===== */
.btn-register {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: white;
    border: none;
    padding: clamp(12px, 3vh, 15px) clamp(16px, 4vw, 20px);
    border-radius: 12px;
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
}

    .btn-register:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(74, 123, 167, 0.3);
    }

    .btn-register svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease;
    overflow: hidden;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Header */
.modal-header {
    background: linear-gradient(135deg, #4a7ba7 0%, #5b8fb9 100%);
    padding: 20px;
    position: relative;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.modal-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 4px;
    margin-left: 32px;
}

/* Close button */
.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-close svg {
    width: 16px;
    height: 16px;
    stroke: white;
    stroke-width: 2;
}

/* Modal Body */
.modal-body {
    padding: 24px;
}

.modal-form-group {
    margin-bottom: 16px;
}

.modal-form-group:last-of-type {
    margin-bottom: 0;
}

.modal-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.modal-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
    color: #333;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: #4a7ba7;
    background: white;
    box-shadow: 0 0 0 3px rgba(74, 123, 167, 0.15);
}

.modal-input::placeholder {
    color: #aaa;
}

/* Input con unidad */
.modal-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.modal-input-wrapper .modal-input {
    padding-right: 50px;
}

.modal-input-unit {
    position: absolute;
    right: 14px;
    font-size: 14px;
    color: #888;
    font-weight: 500;
    pointer-events: none;
}

/* Modal Footer */
.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 10px;
}

/* Botones de Modal */
.btn-modal {
    flex: 1;
    padding: 14px 16px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-modal svg {
    width: 18px;
    height: 18px;
}

.btn-modal.btn-primary {
    background: linear-gradient(135deg, #4a7ba7 0%, #5b8fb9 100%);
    color: white;
}

.btn-modal.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-modal.btn-primary:active {
    transform: translateY(0);
}

.btn-modal.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-modal.btn-secondary:hover {
    background: #e5e5e5;
}

/* ===== ACTION BUTTONS (Volver + Registrar) ===== */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-back {
    flex: 0 0 20%;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: clamp(12px, 3vh, 15px) clamp(10px, 2vw, 14px);
    border-radius: 12px;
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 44px;
    text-decoration: none;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.btn-back svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.action-buttons .btn-register {
    flex: 1;
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 90%;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: linear-gradient(135deg, #28a745 0%, #34c759 100%);
}

.toast-error {
    background: linear-gradient(135deg, #dc3545 0%, #ff4757 100%);
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast-icon svg {
    width: 100%;
    height: 100%;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
}

@media (max-width: 480px) {
    .action-buttons {
        gap: 8px;
    }

    .btn-back {
        flex: 0 0 25%;
        padding: 12px 8px;
        font-size: 12px;
    }

    .btn-back svg {
        width: 16px;
        height: 16px;
    }
}

/* ===== BOTONES ADICIONALES ===== */
.btn-logout {
    background: rgba(220, 53, 69, 0.2);
    border: 2px solid rgba(220, 53, 69, 0.4);
    color: #ff6b7a;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(220, 53, 69, 0.3);
    border-color: rgba(220, 53, 69, 0.6);
    transform: translateY(-2px);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-detail {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-detail:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.btn-action {
    background: linear-gradient(135deg, #4a7ba7 0%, #5b8fb9 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 123, 167, 0.3);
}

.btn-danger {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #ff6b7a;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-danger:hover {
    background: rgba(220, 53, 69, 0.25);
    transform: translateY(-1px);
}

/* ===== UTILITIES ===== */
.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .card {
        margin: 0 15px 15px;
        padding: 16px;
    }

    .section-title {
        margin: 20px 15px 12px;
    }

    .welcome-section {
        margin: 0 15px 15px;
        padding: 20px;
    }

    .nav-item {
        padding: 5px 10px;
        min-width: 50px;
    }
}

/* ===== GYM MORE MENU (overlay popup) ===== */
.gym-more-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
    animation: gymOverlayIn 0.2s ease-out;
}

@keyframes gymOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gym-more-menu {
    position: fixed;
    bottom: 70px;
    right: 12px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 8px 0;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    animation: gymMenuSlideUp 0.2s ease-out;
}

@keyframes gymMenuSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gym-more-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    color: #4a7ba7;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.gym-more-item:hover,
.gym-more-item:active {
    background: rgba(74, 123, 167, 0.08);
}

.gym-more-item.active {
    color: #2d5a7b;
    font-weight: 700;
    background: rgba(74, 123, 167, 0.06);
}

.gym-more-item i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.gym-more-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 4px 16px;
}
