:root {
    --bg: #1A1F3C;
    --card: #1f2544;
    --gold: #FFD700;
    --magenta: #E6005C;
    --text: #ffffff;
    --gray: #aaa;
    --white: #ffffff;
    --footer-bg: #0f1225;
}

body.light-mode {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1A1F3C;
    --gold: #A67C00;
    /* Darker bronze/gold for contrast on white */
    --gray: #555;
    --footer-bg: #eef2f5;
    background: var(--bg);
}

/* Toggle Button Style */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
    z-index: 10;
}

body.light-mode .theme-toggle {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: 50px;
}

/* Profile Container */
.profile-container {
    max-width: 1400px;
    /* Widened to fill screen as requested */
    width: 95%;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.profile-header {
    max-width: 600px;
    /* Keep profile info compact/centered */
    margin: 0 auto 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 15px;
}

.avatar-container {
    position: relative;
    width: 175px;
    /* Adjusted size as requested */
    height: 175px;
    max-width: 90vw;
    /* Safety for mobile */
    max-height: 90vw;
}

.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    /* Ensures the sun/logo fits nicely */
    border: 2px solid var(--bg);
    position: relative;
    z-index: 2;
}

.avatar-ring {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--gold), var(--magenta));
    z-index: 1;
}

.profile-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    justify-content: center;
    /* Center flex items */
    display: flex;
    align-items: center;
    gap: 5px;
}

.verified-badge {
    color: var(--gold);
    font-size: 0.9rem;
}

.bio {
    font-size: 0.95rem;
    color: var(--gray);
    margin-top: 10px;
    white-space: pre-line;
    /* Respect newlines in text */
    line-height: 1.4;
}

.stats-row {
    display: flex;
    gap: 15px;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 30px;
}

.btn {
    text-decoration: none;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--text);
    color: var(--bg);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Feed Grid */
.feed-grid {
    display: grid;
    /* Desktop: 5 Columns as requested */
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

/* Mobile Responsiveness for Grid */
@media (max-width: 768px) {
    .feed-grid {
        /* Mobile: 3 Columns as requested */
        grid-template-columns: repeat(3, 1fr);
    }
}

.feed-item {
    aspect-ratio: 9/16;
    background: #000;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

/* Footer Styles - Premium Upgrade */
.footer-elegant {
    text-align: center;
    margin-top: 80px;
    padding: 40px 20px 60px;
    /* More bottom padding */
    font-size: 0.9rem;
    color: var(--gray);
    background: linear-gradient(to top, var(--footer-bg), transparent);
    border-top: 1px solid transparent;
    border-image: linear-gradient(90deg, transparent, var(--gold), transparent) 1;
    font-weight: 300;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    position: relative;
}

.footer-elegant::before {
    content: '♦';
    display: block;
    color: var(--gold);
    font-size: 1.2rem;
    margin-bottom: 15px;
    opacity: 0.8;
}

.footer-highlight {
    color: var(--gold);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.3s;
}

.footer-highlight:hover {
    color: var(--magenta);
}

.heart-beat {
    display: inline-block;
    color: var(--magenta);
    animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.3);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.3);
    }

    60% {
        transform: scale(1);
    }
}

.feed-item img,
.feed-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Modal - Instagram Style Layout */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* Slightly lighter for focus */
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
    /* Space around */
}

.modal.active {
    display: flex;
}

.modal-content {
    background: black;
    width: 100%;
    max-width: 1100px;
    /* Wider for 2 cols */
    height: 85vh;
    /* Fixed height for desktop look */
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    /* Video takes more space, Comments less */
    border-radius: 4px;
    /* Subtle radius like Insta */
    overflow: hidden;
}

/* Left Column: Media */
.media-container {
    background: #000;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.media-container img,
.media-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Never crop the video/image in modal */
}

/* Right Column: Interaction */
.interaction-container {
    background: var(--card);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    height: 100%;
}

/* Header inside Interaction (Author info) */
#postDescription {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

#postDescription img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Scrollable Comment Area */
.comments-list {
    flex: 1;
    /* Takes all available space */
    padding: 15px;
    overflow-y: auto;
    font-size: 0.9rem;
}

.comment {
    margin-bottom: 12px;
}

.comment strong {
    color: var(--text);
    margin-right: 5px;
}

/* Fixed Footer Form */
.comment-form {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--card);
}

.comment-form input {
    width: 100%;
    margin-bottom: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    color: white;
    border-radius: 4px;
}

.comment-form button {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: none;
    color: #4CAF50;
    /* Insta-like blue or Brand Magenta */
    font-weight: 600;
    cursor: pointer;
    text-align: right;
}

.comment-form button:hover {
    color: white;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 101;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .modal-content {
        display: flex;
        flex-direction: column;
        height: auto;
        max-height: 95vh;
        width: 100%;
    }

    .media-container {
        height: auto;
        max-height: 60vh;
        /* Video on top */
        background: black;
    }

    .interaction-container {
        flex: 1;
        height: auto;
        overflow: hidden;
        /* Let internal parts scroll */
    }

    .comments-list {
        max-height: 200px;
        /* Limit comment height on mobile */
    }
}

/* --- Micro Screen Optimization & Text Wrapping --- */
* {
    /* Prevents long words/links from breaking containers */
    overflow-wrap: break-word;
    word-wrap: break-word;
}

@media (max-width: 380px) {
    html {
        font-size: 14px; /* Scales down ALL rem-based fonts */
    }
    
    .profile-info h1 {
        font-size: 1.3rem;
    }
    
    .bio {
        font-size: 0.85rem;
    }
    
    .btn {
        font-size: 0.8rem !important;
        padding: 8px !important;
    }
    
    h2, h3 {
        font-size: 1.2rem !important;
    }
    
    .presentation-section, .planes-section {
        padding: 1.2rem !important;
    }
    
    .presentation-section ul li {
        font-size: 0.85rem !important;
    }
    
    .action-buttons a {
        min-width: 100px !important;
    }
    
    /* Optimize the newly added header */
    h2[style*="1.6rem"] {
        font-size: 1.3rem !important;
    }
}