/**
 * ========================================
 * SOCIAL MEDIA FEED - ESTILOS CSS
 * ========================================
 *
 * Estilos para el módulo de Instagram Feed
 * The One Pro Therapy
 *
 * @version 1.0.0
 * @author luis barrolleta - Claude Code Assistant
 */

/* ========================================
   VARIABLES CSS
   ======================================== */

:root {
    --theone-sm-gold: #BF8924;
    --theone-sm-gold-light: #E5B84F;
    --theone-sm-gold-dark: #9A6B1A;
    --theone-sm-dark: #261C14;
    --theone-sm-white: #FFFFFF;
    --theone-sm-gray-light: #F5F5F5;
    --theone-sm-gray: #E0E0E0;
    --theone-sm-overlay: rgba(0, 0, 0, 0.7);
    --theone-sm-border-radius: 8px;
    --theone-sm-transition: all 0.3s ease;
    --theone-sm-gap: 15px;
}


/* ========================================
   PERFIL DE INSTAGRAM
   ======================================== */

.theone-sm-profile {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: var(--theone-sm-white);
    border-radius: var(--theone-sm-border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.theone-sm-profile-pic {
    flex-shrink: 0;
}

.theone-sm-profile-pic img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--theone-sm-gold);
    object-fit: cover;
}

.theone-sm-profile-info {
    flex: 1;
}

.theone-sm-profile-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--theone-sm-dark);
    margin: 0 0 5px 0;
}

.theone-sm-profile-username {
    font-size: 16px;
    color: var(--theone-sm-gold);
    margin: 0 0 10px 0;
    font-weight: 500;
}

.theone-sm-profile-bio {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 0;
}


/* ========================================
   CONTENEDOR DEL FEED
   ======================================== */

.theone-sm-feed {
    width: 100%;
    margin: 0 auto;
}


/* ========================================
   GRID DE POSTS
   ======================================== */

.theone-sm-grid {
    display: grid;
    gap: var(--theone-sm-gap);
    margin-bottom: 30px;
}

/* Grid de 4 columnas (desktop) */
.theone-sm-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

/* Grid de 3 columnas */
.theone-sm-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

/* Grid de 2 columnas */
.theone-sm-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}


/* ========================================
   ITEM DE POST
   ======================================== */

.theone-sm-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--theone-sm-border-radius);
    background: var(--theone-sm-gray-light);
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: var(--theone-sm-transition);
}

.theone-sm-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.theone-sm-item a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}


/* ========================================
   MEDIA (IMÁGENES Y VIDEOS)
   ======================================== */

.theone-sm-media {
    width: 100%;
    height: 100%;
    position: relative;
}

.theone-sm-image,
.theone-sm-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--theone-sm-transition);
}

.theone-sm-item:hover .theone-sm-image,
.theone-sm-item:hover .theone-sm-video {
    transform: scale(1.05);
}


/* ========================================
   ICONO DE PLAY (VIDEOS)
   ======================================== */

.theone-sm-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: var(--theone-sm-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theone-sm-white);
    font-size: 24px;
    pointer-events: none;
    z-index: 2;
    transition: var(--theone-sm-transition);
    box-shadow: 0 4px 15px rgba(191, 137, 36, 0.4);
}

.theone-sm-item:hover .theone-sm-play {
    transform: translate(-50%, -50%) scale(1.1);
    background: var(--theone-sm-gold-light);
}

.theone-sm-play i {
    font-size: 28px;
}


/* ========================================
   OVERLAY CON INFORMACIÓN
   ======================================== */

.theone-sm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--theone-sm-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--theone-sm-transition);
    z-index: 1;
    padding: 20px;
}

.theone-sm-item:hover .theone-sm-overlay {
    opacity: 1;
}

.theone-sm-overlay-content {
    text-align: center;
    color: var(--theone-sm-white);
}

.theone-sm-caption {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.theone-sm-date {
    font-size: 12px;
    color: var(--theone-sm-gold-light);
    display: block;
    margin-bottom: 10px;
}

.theone-sm-likes,
.theone-sm-comments {
    display: inline-block;
    margin: 0 10px;
    font-size: 13px;
}

.theone-sm-likes i,
.theone-sm-comments i {
    margin-right: 5px;
}


/* ========================================
   BOTÓN DE SEGUIR
   ======================================== */

.theone-sm-follow-container {
    text-align: center;
    margin-top: 20px;
}

.theone-sm-follow-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 40px;
    background: linear-gradient(135deg, var(--theone-sm-gold-light) 0%, var(--theone-sm-gold) 100%);
    color: var(--theone-sm-white);
    text-decoration: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    transition: var(--theone-sm-transition);
    box-shadow: 0 4px 15px rgba(191, 137, 36, 0.3);
}

.theone-sm-follow-btn:hover {
    background: linear-gradient(135deg, var(--theone-sm-gold) 0%, var(--theone-sm-gold-dark) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(191, 137, 36, 0.4);
    color: var(--theone-sm-white);
}

.theone-sm-follow-btn i {
    font-size: 20px;
}


/* ========================================
   LOADING SPINNER
   ======================================== */

.theone-sm-loading {
    text-align: center;
    padding: 60px 20px;
}

.theone-sm-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--theone-sm-gray);
    border-top-color: var(--theone-sm-gold);
    border-radius: 50%;
    animation: theone-sm-spin 1s linear infinite;
}

@keyframes theone-sm-spin {
    to { transform: rotate(360deg); }
}

.theone-sm-loading p {
    color: #666;
    font-size: 14px;
}


/* ========================================
   MENSAJE DE ERROR
   ======================================== */

.theone-sm-error {
    text-align: center;
    padding: 60px 20px;
    color: #e74c3c;
}

.theone-sm-error i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.theone-sm-error p {
    font-size: 16px;
    margin: 0;
}


/* ========================================
   ANIMACIONES
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ========================================
   MODO CAROUSEL (OPCIONAL)
   ======================================== */

.theone-sm-grid[data-display-mode="carousel"] {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--theone-sm-gold) var(--theone-sm-gray);
}

.theone-sm-grid[data-display-mode="carousel"] .theone-sm-item {
    flex: 0 0 300px;
    scroll-snap-align: start;
}

.theone-sm-grid[data-display-mode="carousel"]::-webkit-scrollbar {
    height: 8px;
}

.theone-sm-grid[data-display-mode="carousel"]::-webkit-scrollbar-track {
    background: var(--theone-sm-gray);
    border-radius: 10px;
}

.theone-sm-grid[data-display-mode="carousel"]::-webkit-scrollbar-thumb {
    background: var(--theone-sm-gold);
    border-radius: 10px;
}

.theone-sm-grid[data-display-mode="carousel"]::-webkit-scrollbar-thumb:hover {
    background: var(--theone-sm-gold-dark);
}


/* ========================================
   RESPONSIVE - TABLET
   ======================================== */

@media (max-width: 1024px) {
    .theone-sm-grid[data-columns="4"] {
        grid-template-columns: repeat(3, 1fr);
    }

    .theone-sm-profile {
        padding: 25px;
    }

    .theone-sm-profile-pic img {
        width: 70px;
        height: 70px;
    }

    .theone-sm-profile-name {
        font-size: 20px;
    }
}


/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .theone-sm-grid[data-columns="4"],
    .theone-sm-grid[data-columns="3"] {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Usar data-columns-mobile si está definido */
    .theone-sm-grid[data-columns-mobile="1"] {
        grid-template-columns: 1fr;
    }

    .theone-sm-grid[data-columns-mobile="2"] {
        grid-template-columns: repeat(2, 1fr);
    }

    .theone-sm-grid[data-columns-mobile="3"] {
        grid-template-columns: repeat(3, 1fr);
    }

    .theone-sm-profile {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .theone-sm-profile-pic img {
        width: 60px;
        height: 60px;
    }

    .theone-sm-profile-name {
        font-size: 18px;
    }

    .theone-sm-profile-username {
        font-size: 14px;
    }

    .theone-sm-profile-bio {
        font-size: 13px;
    }

    .theone-sm-follow-btn {
        padding: 12px 30px;
        font-size: 14px;
    }

    .theone-sm-caption {
        font-size: 12px;
    }

    .theone-sm-play {
        width: 50px;
        height: 50px;
    }

    .theone-sm-play i {
        font-size: 22px;
    }

    :root {
        --theone-sm-gap: 10px;
    }
}


/* ========================================
   MODO MASONRY (PINTEREST STYLE)
   ======================================== */

.theone-sm-grid[data-display-mode="masonry"] {
    display: grid;
    grid-auto-flow: dense;
    grid-auto-rows: 10px;
}

.theone-sm-grid[data-display-mode="masonry"] .theone-sm-item {
    aspect-ratio: auto;
}

.theone-sm-grid[data-display-mode="masonry"] .theone-sm-item:nth-child(3n) {
    grid-row: span 30;
}

.theone-sm-grid[data-display-mode="masonry"] .theone-sm-item:nth-child(3n+1) {
    grid-row: span 25;
}

.theone-sm-grid[data-display-mode="masonry"] .theone-sm-item:nth-child(3n+2) {
    grid-row: span 35;
}


/* ========================================
   ACCESIBILIDAD
   ======================================== */

.theone-sm-item:focus-within {
    outline: 3px solid var(--theone-sm-gold);
    outline-offset: 2px;
}

.theone-sm-follow-btn:focus {
    outline: 3px solid var(--theone-sm-gold-dark);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ========================================
   DARK MODE (OPCIONAL)
   ======================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --theone-sm-white: #1a1a1a;
        --theone-sm-dark: #ffffff;
        --theone-sm-gray-light: #2a2a2a;
        --theone-sm-gray: #3a3a3a;
    }

    .theone-sm-profile {
        background: var(--theone-sm-gray-light);
    }

    .theone-sm-profile-bio {
        color: #aaa;
    }

    .theone-sm-loading p {
        color: #aaa;
    }
}


/* ========================================
   IMPRESIÓN (PRINT)
   ======================================== */

@media print {
    .theone-sm-overlay,
    .theone-sm-follow-btn,
    .theone-sm-play {
        display: none !important;
    }

    .theone-sm-item {
        break-inside: avoid;
    }
}
