/* Base Styles */
:root {
    --primary-color: #4682B4;
    --secondary-color: #8A2BE2;
    --background-color: #000000;
    --text-color: #ffffff;
    --border-color: #999999;
    --border-radius: 10px;
    --transition-speed: 0.3s;
    --grid-gap: 2px;
}

/* Estilos globales para asegurar scroll en todos los dominios */
html, body {
    overflow-y: auto !important;
    height: auto !important;
    position: static !important;
    -webkit-overflow-scrolling: touch !important;
}

/* OCULTAR BARRA SCROLL */
body::-webkit-scrollbar {
    display: none;
}

.add-post-button {
    position: fixed;
    top: 20px;
    right: 15px;
    z-index: 1000;
}

.add-button {
    background-color: rgba(128, 128, 128, 0.2); /* Very transparent gray background */
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 1.5em;
    padding: 0;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    position: relative;
    min-height: 100vh;
}

body::-webkit-scrollbar {
    display: none;
}

/* Particles Background */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, rgba(70,130,180,0.05) 0%, rgba(138,43,226,0.05) 100%);
    pointer-events: none !important; /* Asegura que no interfiera con el scroll */
}

/* Language Selector */
.language-selector {
    background-color: rgba(0, 0, 0, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.language-selector a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all var(--transition-speed) ease;
}

.language-selector a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.language-selector a.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Profile Section */
.profile-section {
    background-color: rgba(0, 0, 0, 0.9);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem; /* Reduced margin */
}

.profile-image {
    position: relative;
    display: inline-block;
}

.profile-image img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border: 3px solid var(--border-color);
    padding: 3px;
    transition: transform var(--transition-speed) ease;
}

.profile-name {
    color: var(--text-color);
    font-weight: 700;
    font-size: 1.8rem;
}

.profile-bio {
    color: var(--text-color);
    max-width: 600px;
    margin: 0 auto;
    margin-bottom: 0px !important;
}

/* Posts Grid */
.posts-grid {
    margin-bottom: 3rem;
}

.posts-grid .row {
    margin: calc(-1 * var(--grid-gap));
}

.post-item {
    cursor: pointer;
    padding: var(--grid-gap);
    position: relative;
}

.post-card {
    position: relative;
    overflow: hidden;
    background-color: #000;
    aspect-ratio: 4/5;
}

.post-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all var(--transition-speed) ease;
}

.post-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 1rem;
    color: white;
    opacity: 0;
    transition: all var(--transition-speed) ease;
}

.post-card:hover .post-overlay {
    opacity: 1;
}

.post-overlay h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.post-overlay p {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.9;
}

/* Edit Buttons */
.btn-edit {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    transition: all var(--transition-speed) ease;
}

.btn-delete {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    transition: all var(--transition-speed) ease;
}

.post-item:hover .btn-edit,
.post-item:hover .btn-delete,
.profile-image:hover .btn-edit {
    opacity: 1;
}

.btn-edit:hover,
.btn-delete:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Modal Styles */
.modal-content {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Ensure modals appear above the header */
.modal {
    z-index: 10000 !important; /* Higher than the header's z-index (9999) */
}

.modal-backdrop {
    z-index: 9998 !important; /* Just below the header but above other content */
}

.modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.modal-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.form-control {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.form-control:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(70, 130, 180, 0.25) !important;
}

/* Footer */
.footer {
    background-color: rgba(0, 0, 0, 0.9);
    padding: 1rem 0;
    position: relative;
    /* Removed font-size from here to avoid conflicts */
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer p {
    font-size: 0.9rem !important; /* Uncommented and increased size */
    color: var(--border-color) !important; /* Optional: Adjust color if needed */
    margin-bottom: 0 !important; /* Remove default paragraph margin */
}

/* Toast Notifications */
.toast {
    /* background-color: rgba(0, 0, 0, 0.9) !important;*/
    background-color: rgba(41, 180, 50, 0.9) !important;
    border: 1px solid rgba(1, 85, 2, 0.801) !important;
}

.post-item.sortable-drag {
    opacity: 0.5;
}
/* Mobile-First Grid Layout */
@media (max-width: 767px) {
    .container {
        padding-left: var(--grid-gap);
        padding-right: var(--grid-gap);
    }

    .post-item {
        padding: var(--grid-gap);
    }

    .post-card {
        border-radius: 0;
        box-shadow: none;
    }

    .col-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .post-overlay {
        display: none;
    }

    .btn-edit {
        opacity: 1;
        width: 30px;
        height: 30px;
        top: 5px;
        right: 5px;
    }

    .profile-section {
        padding: 1rem;
        border-radius: 0;
        margin-bottom: 1rem;
    }

    .profile-image img {
        width: 100px;
        height: 100px;
    }

    .profile-name {
        font-size: 1.4rem;
    }

    .profile-bio {
        font-size: 0.9rem;
    }

    /* --- START: Mobile styles for user-info --- */
    body .container .user-info {
        position: fixed !important; /* Fixed position for better visibility */
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        text-align: center !important;
        background-color: rgba(0, 0, 0, 0.9) !important;
        padding: 5px !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important; /* Horizontal layout */
        align-items: center !important;
        justify-content: space-between !important; /* Space between email and buttons */
        z-index: 9999 !important; /* Above everything including add button */
        border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
        margin: 0 !important;
        height: 65px !important; /* Slightly reduced from 70px */
        min-height: 65px !important;
    }

    body .container .user-info small {
        display: inline-block !important;
        font-size: 0.7rem !important;
        margin: 0 !important;
        padding: 2px 5px !important;
        max-width: 40% !important; /* Limit width */
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-align: left !important;
        background-color: rgba(0, 0, 0, 0.7) !important;
        border-radius: 3px !important;
    }

    /* Container for the buttons */
    body .container .user-info .button-container {
        display: flex !important;
        justify-content: flex-end !important;
        /* gap: 15px !important; */ /* Replaced with margin for individual buttons */
        margin: 0 !important;
        padding: 0 !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }

    body .container .user-info .button-container .btn {
        margin: 0 !important;
        padding: 0 !important; /* Ensure no padding */
        width: 36px !important; /* Reduced from 40px */
        height: 36px !important; /* Reduced from 40px */
        min-width: 36px !important; /* Reduced from 40px */
        min-height: 36px !important; /* Reduced from 40px */
        max-width: 36px !important; /* Reduced from 40px */
        max-height: 36px !important; /* Reduced from 40px */
        border-radius: 50% !important;
        display: flex !important; /* Use flexbox */
        align-items: center !important; /* Center vertically */
        justify-content: center !important; /* Center horizontally */
        border: none !important;
        overflow: hidden !important;
        color: white !important; /* Ensure icon color is white */
    }

    /* Add margin to buttons for spacing, excluding the first one */
    body .container .user-info .button-container .btn:not(:first-child) {
        margin-left: 15px; /* Reduced margin between buttons */
    }

    /* Text hiding handled by general .btn styles below (around line 573) */

    /* Ensure icons have some minimum size/visibility */
    body .container .user-info .button-container .btn i {
        font-size: 1.2rem !important; /* Larger icon size */
        vertical-align: middle !important;
        margin: 0 !important; /* Ensure no margin */
        padding: 0 !important; /* Ensure no padding */
        line-height: 1 !important; /* Ensure proper line height */
    }

    /* Add margin to profile section to avoid overlap */
    body .container .profile-section {
        margin-top: 80px !important; /* Reduced to 80px as requested */
        padding-top: 15px !important; /* Increased padding for better spacing */
        position: relative !important;
        z-index: 1 !important;
    }

    /* Adjust add-post-button position to avoid overlap with user-info */
    body .container .add-post-button {
        top: 80px !important; /* Adjusted to match new profile section margin */
        right: 10px !important;
        position: fixed !important;
        z-index: 1000 !important;
    }
    
    /* Ensure add button has transparent gray background and only shows icon */
    body .container .add-post-button .add-button {
        background-color: rgba(128, 128, 128, 0.2) !important; /* Very transparent gray */
        color: white !important;
        text-indent: -9999px !important; /* Hide text but keep accessible */
        white-space: nowrap !important;
        overflow: hidden !important;
    }
    
    body .container .add-post-button .add-button::before {
        content: "+" !important;
        text-indent: 0 !important;
        display: block !important;
        line-height: 40px !important;
        text-align: center !important;
        width: 100% !important;
    }
    /* --- END: Mobile styles for user-info --- */
    footer.footer .container p,
    footer.footer .container p *,
    .footer p,
    .footer .container p,
    .footer-copyright { /* Added .footer-copyright to ensure it's included */
        font-size: 0.9rem !important; /* Set to exactly 0.9rem as requested */
        line-height: 1.2 !important; /* Tighter line height */
        letter-spacing: -0.01em !important; /* Slightly tighter letter spacing */
    }
} /* This closes the @media (max-width: 767px) block */

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Removed user-info styles from here as they were moved to the correct media query */
}

/* Desktop styles for user-info */
@media (min-width: 768px) {
    body .container .user-info {
        position: fixed !important; /* Fixed position on desktop */
        top: 20px !important;       /* Moved up significantly */
        right: 15px !important;
        left: auto !important;
        width: auto !important;     /* Adjust width automatically */
        text-align: right !important; /* Restore text alignment */
        margin-top: 0 !important; /* Remove top margin */
        flex-direction: column !important;
        background-color: transparent !important;
        border-bottom: none !important;
        box-shadow: none !important;
    }

    /* Show button text on desktop */
    body .container .user-info .button-container .btn .button-text {
        display: inline !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        visibility: visible !important;
    }

    body .container .user-info .button-container .btn {
         padding: 0.375rem 0.75rem !important; /* Original padding */
         width: auto !important;
         height: auto !important;
         min-width: auto !important;
         min-height: auto !important;
         max-width: none !important;
         max-height: none !important;
         border-radius: 0.25rem !important;
         margin-bottom: 5px !important; /* Original spacing */
         background-color: transparent !important; /* Reset background */
    }
    body .container .user-info .button-container .btn i {
         text-indent: 0 !important;
         font-size: 1.2rem !important; /* Original size */
         display: block !important;
    }
    
    /* Apply the same colors as mobile view */
    body .container .user-info .button-container .btn.text-info {
         color: #f8f9fa !important; /* Changed to light grey */
         background-color: transparent !important;
    }
    
    body .container .user-info .button-container .btn.text-light {
         color: #f8f9fa !important; /* Bootstrap light color */
         background-color: transparent !important;
    }
    
    body .container .user-info .button-container .btn.text-primary {
         color: #f8f9fa !important; /* Changed to light grey */
         background-color: rgba(128, 128, 128, 0.2) !important; /* Kept transparent grey background */
         /* Make button round */
         width: 40px !important;
         height: 40px !important;
         padding: 0 !important; /* Remove padding for round button */
         border-radius: 50% !important;
         /* Removed flex properties - parent will handle layout */
         /* Ensure icon is centered if needed by general icon styles */
    }

    /* Ensure buttons are in a row on desktop */
    body .container .user-info .button-container {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important; /* Vertically align buttons */
        gap: 10px !important; /* Add some space between buttons */
    }

     body .container .user-info small {
        display: block !important; /* Make email display above buttons */
        margin-bottom: 10px !important; /* Add space below email */
        max-width: none !important;
        font-size: 0.8rem !important; /* Slightly smaller email text */
        text-align: right !important; /* Align email to the right */
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Estilos adicionales para asegurar scroll en todos los dominios */
.scroll-helper {
    height: 1px;
    margin-top: 50px;
    clear: both;
}

/* Estilo específico para texto del footer */
.footer-copyright {
    font-size: 1.5rem !important; /* Set to exactly 1.5rem as requested */
    line-height: 1.2 !important;
    margin-bottom: 0 !important;
}

/* Asegurar que el contenido sea scrollable en dispositivos móviles */
@media (max-width: 767px) {
    /* Ensure modals appear at the top in mobile view */
    .modal-dialog {
        margin: 10px auto !important;
        max-width: 95% !important;
    }
    
    /* Position modal content to be fully visible */
    .modal-content {
        margin-top: 70px !important; /* Just below the header */
    }
    
    html, body {
        -webkit-overflow-scrolling: touch !important;
        overflow-y: auto !important;
        height: auto !important;
        position: static !important;
    }

    /* Removed duplicate footer-copyright style as it's now included in the previous media query */
    
    #particles-js {
        pointer-events: none !important;
    }
    
    .container {
        overflow: visible !important;
        padding-top: 10px !important;
    }
    
    /* Estilos adicionales para asegurar que los botones de usuario sean visibles */
    main.container .user-info {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 9999 !important;
    }
    
    /* Asegurar que los botones sean pequeños y circulares y solo muestren iconos */
    main.container .user-info .button-container .btn,
    main.container .btn,
    .btn {
        width: 28px !important;
        height: 28px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        color: white !important; /* Ensure icon color is white */
        text-indent: -9999px !important; /* Hide text but keep accessible */
        white-space: nowrap !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Ensure only icons are visible in buttons */
    main.container .btn i,
    .btn i,
    button i,
    .btn span[class*="icon"],
    button span[class*="icon"] {
        text-indent: 0 !important;
        font-size: 1.2rem !important; /* Larger icons */
        display: block !important;
    }

    /* Hiding text span specifically for header buttons */
    body .container .user-info .button-container .btn .button-text {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Ensure icon color is white */
    main.container .user-info .button-container .btn i,
    main.container .user-info .button-container .btn span[class*="icon"],
    main.container .add-post-button .add-button::before { /* Target the '+' icon specifically */
        color: white !important;
    }

    /* Specific style for the Add Post button in the mobile header */
    body .container .user-info .button-container .btn.text-primary {
        background-color: rgba(128, 128, 128, 0.2); /* Very transparent gray, removed !important */
        /* border-radius is handled by the general .btn rule */
    }
    
    /* Ajustar el espacio para el contenido principal */
    main.container .profile-section {
        margin-top: 80px !important; /* Reducido a 80px como solicitado */
    }
}

/* Estilos específicos para pantallas muy pequeñas */
@media (max-width: 375px) {
    body .container .user-info .button-container .btn {
        width: 32px !important; /* Slightly reduced from 34px */
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        max-width: 32px !important;
        max-height: 32px !important;
    }
    
    body .container .user-info .button-container .btn i {
        font-size: 1rem !important; /* Increased from 0.8rem */
    }
    
    body .container .user-info small {
        font-size: 0.75rem !important; /* Slightly larger font */
        max-width: 35% !important;
    }
    
    /* Extra small footer text */
    footer.footer .container p,
    .footer p,
    .footer .container p,
    footer.mt-auto p,
    .footer-copyright { /* Added .footer-copyright to ensure it's included */
        font-size: 0.65rem !important; /* Set to exactly 0.65rem as requested */
    }
}

/* Button styles based on app11_hash but larger */
.btn-icon {
    width: 65px; /* Reduced from 70px */
    height: 65px; /* Reduced from 70px */
    border-radius: 50%;
    padding: 0;
    margin: 0 15px; /* Reduced from 20px to make buttons closer */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background-color: transparent;
    border: 1px solid rgba(0,0,0,0.1);
}

body.dark-theme .btn-icon {
    border-color: rgba(255,255,255,0.2);
    color: #fff;
}

.btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 5px rgba(0,0,0,0.1);
}

body.dark-theme .btn-icon:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Even larger buttons for mobile view */
@media (max-width: 767px) {
    .btn-icon, .btn.btn-sm.btn-icon {
        width: 70px !important; /* Reduced from 80px */
        height: 70px !important; /* Reduced from 80px */
        margin: 0 15px !important; /* Reduced from 25px to make buttons closer */
    }
    
    .btn-icon i, .btn.btn-sm.btn-icon i {
        font-size: 2rem !important; /* Reduced from 2.5rem */
    }
    
    /* First button shouldn't have left margin */
    .button-container .btn-icon:first-child,
    .button-container .btn.btn-sm.btn-icon:first-child {
        margin-left: 0 !important;
    }
}