/* ===================================
   Estilos para Tutorías y Tutores
   Compatible con modo claro/oscuro
   =================================== */

:root{
    --tutor-card-bg: #ffffff;
    --tutor-card-border: rgba(0,0,0,0.08);
    --tutor-accent: var(--primary-600);
    --tutor-muted: var(--text-secondary);
    --grupo-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --grupo-shadow-hover: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

[data-theme="dark"] {
    --tutor-card-bg: #1e293b;
    --tutor-card-border: rgba(148, 163, 184, 0.2);
    --grupo-shadow: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -1px rgba(0,0,0,0.2);
    --grupo-shadow-hover: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -2px rgba(0,0,0,0.3);
}

/* ===== RADIO BUTTONS TIPO GRUPO (PÚBLICO/PRIVADO) ===== */
input[type="radio"][name="tipo"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-400);
    border-radius: 50%;
    margin-right: 8px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    vertical-align: middle;
}

input[type="radio"][name="tipo"]:checked {
    border-color: var(--primary-600);
    background: var(--primary-600);
}

input[type="radio"][name="tipo"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

input[type="radio"][name="tipo"]:hover {
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Labels de tipo grupo con mejor indicador visual */
label[onclick*="actualizarTipo"] {
    transition: all 0.3s ease !important;
    position: relative;
}

label[onclick*="actualizarTipo"]::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: var(--radius-lg);
    background: var(--primary-600);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

label[onclick*="actualizarTipo"]:has(input:checked) {
    border-color: var(--primary-600) !important;
    border-width: 3px !important;
    background: var(--primary-50) !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] label[onclick*="actualizarTipo"]:has(input:checked) {
    background: rgba(99, 102, 241, 0.1) !important;
}

/* ===== HERO SECTION ===== */
.tutorias-hero{
    padding-top: 110px;
    padding-bottom: 48px;
    text-align: center;
    background: linear-gradient(135deg, rgba(99,102,241,0.05) 0%, rgba(168,85,247,0.05) 100%);
}
.tutorias-hero .hero-badge{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-100);
    color: var(--primary-700);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 16px;
}
.tutorias-hero .hero-title{
    font-size: 2.8rem;
    margin: 0 0 16px;
    font-weight: 700;
    line-height: 1.2;
}
.tutorias-hero .hero-title .highlight{
    background: linear-gradient(135deg, var(--primary-600), var(--secondary-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.tutorias-hero .hero-description{
    color: var(--text-secondary);
    max-width: 760px;
    margin: 0 auto 24px;
    font-size: 1.125rem;
    line-height: 1.7;
}

/* ===== FILTROS ===== */
.tutorias-filters{
    background: var(--tutor-card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--grupo-shadow);
    margin-bottom: 32px;
    border: 1px solid var(--tutor-card-border);
}
.tutorias-filters label{
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}
.tutorias-filters select,
.tutorias-filters input{
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--tutor-card-border);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--tutor-card-bg);
    color: var(--text-primary);
}
.tutorias-filters select:focus,
.tutorias-filters input:focus{
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* ===== TARJETAS DE TUTORES ===== */
.tutor-grid{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.tutor-card{
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--tutor-card-bg);
    border-radius: 16px;
    border: 1px solid var(--tutor-card-border);
    box-shadow: var(--grupo-shadow);
    align-items: flex-start;
    transition: all 0.3s ease;
}
.tutor-card:hover{
    transform: translateY(-2px);
    box-shadow: var(--grupo-shadow-hover);
    border-color: var(--primary-300);
}
.tutor-card img{
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 12px;
    flex-shrink: 0;
}
.tutor-card strong{
    display: block;
    font-size: 1.1rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}
.tutor-card .bio{
    color: var(--tutor-muted);
    font-size: 0.9rem;
    max-height: 40px;
    overflow: hidden;
    line-height: 1.4;
    margin-top: 4px;
}
.tutor-card .price{
    background: linear-gradient(135deg, var(--primary-100), var(--primary-50));
    color: var(--primary-700);
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    white-space: nowrap;
}

[data-theme="dark"] .tutor-card .price{
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.3), rgba(99, 102, 241, 0.2));
    color: #a5b4fc;
}
.tutor-card .actions{
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.tutor-card .btn{
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}
.badge-promoted{
    background: linear-gradient(135deg, #ffb86b, #ff7a59);
    color: white;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== TARJETAS DE GRUPOS ===== */
.grupo-card{
    background: var(--tutor-card-bg);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--tutor-card-border);
    box-shadow: var(--grupo-shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.grupo-card::before{
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-600), var(--secondary-600));
    opacity: 0;
    transition: opacity 0.3s ease;
}
.grupo-card:hover{
    transform: translateY(-4px);
    box-shadow: var(--grupo-shadow-hover);
    border-color: var(--primary-300);
}
.grupo-card:hover::before{
    opacity: 1;
}
.grupo-card .badge-tipo{
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-tipo.publico{
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}
.badge-tipo.privado{
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}
.grupo-card h3{
    font-size: 1.3rem;
    margin-bottom: 12px;
    color: var(--text-primary);
    padding-right: 100px;
    line-height: 1.3;
}
.grupo-card .descripcion{
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
    min-height: 75px;
}
.grupo-info{
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    padding-top: 16px;
    border-top: 2px solid rgba(79, 70, 229, 0.1);
}

[data-theme="dark"] .grupo-info{
    border-top-color: rgba(147, 197, 253, 0.2);
}
.grupo-info-item{
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.grupo-info-item i{
    color: var(--primary-600);
    width: 20px;
}
.grupo-footer{
    display: flex;
    gap: 12px;
    align-items: center;
}
.badge-estado{
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.badge-estado.activo{
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}
.badge-estado.lleno{
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}
.grupo-footer .btn{
    flex: 1;
    justify-content: center;
}

/* ===== BOTONES ===== */
.btn-pay{
    background: linear-gradient(135deg, var(--primary-600), var(--secondary-600));
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-pay:hover{
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(99,102,241,0.3);
}

/* ===== PERFIL DE TUTOR ===== */
.tutor-profile-header{
    background: linear-gradient(135deg, var(--primary-600), var(--secondary-600));
    color: white;
    padding: 48px 24px;
    border-radius: 20px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.tutor-profile-photo{
    width: 150px;
    height: 150px;
    border-radius: 20px;
    object-fit: cover;
    border: 4px solid rgba(255,255,255,0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.tutor-profile-info h1{
    font-size: 2.5rem;
    margin-bottom: 8px;
}
.tutor-profile-info .bio{
    font-size: 1.125rem;
    opacity: 0.95;
    line-height: 1.6;
}

/* ===== CHAT ===== */
.chat-container{
    background: var(--bg-primary);
    border-radius: 16px;
    border: 1px solid var(--tutor-card-border);
    overflow: hidden;
    box-shadow: var(--grupo-shadow);
}
.chat-messages{
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-secondary);
}
.chat-message{
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
}
.chat-message.own{
    flex-direction: row-reverse;
}
.chat-message .avatar{
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-500);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}
.chat-bubble{
    background: var(--bg-primary);
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 70%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.chat-message.own .chat-bubble{
    background: linear-gradient(135deg, var(--primary-600), var(--secondary-600));
    color: white;
}
.chat-bubble .username{
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 4px;
}
.chat-message.own .chat-bubble .username{
    color: rgba(255,255,255,0.9);
}
.chat-bubble .time{
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 4px;
}
.chat-input-container{
    padding: 16px;
    background: var(--bg-primary);
    border-top: 1px solid var(--tutor-card-border);
    display: flex;
    gap: 12px;
}
.chat-input{
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--primary-200);
    border-radius: 10px;
    font-size: 1rem;
}
.chat-input:focus{
    outline: none;
    border-color: var(--primary-500);
}

/* ===== MODAL PAGO ===== */
.modal-overlay{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}
.modal-content{
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn{
    from{ opacity: 0; transform: translateY(-20px); }
    to{ opacity: 1; transform: translateY(0); }
}
.modal-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.modal-header h3{
    font-size: 1.5rem;
    margin: 0;
}
.modal-close{
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.modal-close:hover{
    background: var(--primary-100);
    color: var(--primary-600);
}
.modal-body{
    margin-bottom: 24px;
}
.precio-display{
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-600);
    text-align: center;
    margin: 24px 0;
}
.modal-footer{
    display: flex;
    gap: 12px;
}
.modal-footer .btn{
    flex: 1;
}

/* ===== DARK MODE ===== */
html.dark-mode{
    --tutor-card-border: rgba(255,255,255,0.06);
    --grupo-shadow: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -1px rgba(0,0,0,0.2);
    --grupo-shadow-hover: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -2px rgba(0,0,0,0.3);
}
html.dark-mode .tutorias-hero{
    background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(168,85,247,0.08) 100%);
}
html.dark-mode .chat-messages{
    background: rgba(0,0,0,0.2);
}

/* ===== RESPONSIVE - PÁGINA CREAR TUTORÍAS ===== */

/* Tablet y móviles grandes: Cambiar grid de 2 columnas a 1 columna */
@media (max-width: 1024px){
    /* Cambiar grid principal a una sola columna */
    .section .container > div[style*="grid-template-columns: 2fr 1fr"] {
        display: flex !important;
        flex-direction: column !important;
        gap: var(--spacing-xl) !important;
    }

    /* Preview debe estar debajo del formulario */
    .section .container > div > div:last-child {
        position: static !important;
        order: 2;
    }

    /* Grid de tipos (Público/Privado) responsive */
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* Móviles: Ajustes adicionales */
@media (max-width: 768px){
    .tutorias-hero .hero-title{ font-size: 2rem; }
    .tutorias-hero{ padding-top: 100px; padding-bottom: 30px; }

    /* Hero de página crear */
    .hero h1 {
        font-size: var(--text-2xl) !important;
    }

    .hero p {
        font-size: var(--text-base) !important;
    }

    /* Breadcrumb más compacto */
    nav ol {
        flex-wrap: wrap;
        font-size: var(--text-sm) !important;
    }

    /* Cards más pequeñas */
    .card {
        padding: var(--spacing-lg) !important;
    }

    form.card {
        padding: var(--spacing-xl) !important;
    }

    /* Botones apilados en móvil */
    form > div:last-child[style*="display: flex"] {
        flex-direction: column !important;
    }

    form > div:last-child[style*="display: flex"] .btn {
        flex: 1 !important;
        width: 100% !important;
    }

    /* Preview más compacto */
    #preview {
        padding: var(--spacing-lg) !important;
    }

    #preview-nombre {
        font-size: var(--text-lg) !important;
        padding-right: 0 !important;
    }

    #preview-badge {
        position: static !important;
        display: inline-block !important;
        margin-bottom: var(--spacing-sm) !important;
    }

    /* Inputs y textareas */
    input[type="text"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important; /* Evita zoom en iOS */
    }

    /* Tarjetas de instrucciones */
    .card ul {
        padding-left: var(--spacing-lg) !important;
        font-size: var(--text-sm) !important;
    }

    /* Tips sidebar */
    div[style*="position: sticky"] .card {
        padding: var(--spacing-md) !important;
    }

    .tutor-card{ flex-direction: column; text-align: center; }
    .tutor-card img{ width: 100px; height: 100px; margin: 0 auto; }
    .tutor-profile-header{ flex-direction: column; text-align: center; }
    .tutor-profile-info h1{ font-size: 1.8rem; }
    .grupo-card h3{ padding-right: 0; margin-bottom: 8px; }
    .badge-tipo{ position: static; display: inline-block; margin-bottom: 8px; }
    .chat-bubble{ max-width: 85%; }
    .precio-display{ font-size: 2rem; }
}

/* Móviles pequeños */
@media (max-width: 480px){
    .tutorias-filters{ padding: 16px; }
    .grupo-footer{ flex-direction: column; }
    .badge-estado{ width: 100%; justify-content: center; }

    /* Hero más compacto */
    .hero {
        min-height: 30vh !important;
        padding-top: var(--spacing-2xl) !important;
    }

    .hero h1 {
        font-size: var(--text-xl) !important;
    }

    /* Formulario más compacto */
    form.card {
        padding: var(--spacing-lg) !important;
    }

    /* Labels e iconos más pequeños */
    label {
        font-size: var(--text-sm) !important;
    }

    /* Grid de tipos uno debajo del otro */
    label[style*="padding"][onclick] {
        padding: var(--spacing-md) !important;
    }

    label[style*="padding"][onclick] i {
        font-size: var(--text-2xl) !important;
    }
}
