/* assets/css/components.css */

/* Typography */
.brand { text-decoration: none; color: var(--text-main); font-weight: 700; display: flex; align-items: center; gap: 10px; }

.desktop-links a { text-decoration: none; color: var(--text-muted); display: flex; font-weight: 500; padding: 8px 12px; transition: color 0.2s ease; }
.desktop-links a:hover { color: var(--accent-gold); }
.desktop-links a.active { color: var(--accent-gold); font-weight: 700; }

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
}

.btn-primary { 
    background: linear-gradient(135deg, #C89B5F, #A07545); 
    color: white; 
}

/* Mobile Nav Items */
.nav-item { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text-muted); font-size: 12px; gap: 4px; }
.nav-item:hover { color: var(--accent-gold); }

/* Post Cards */
.post-card { 
    background: var(--card-bg); 
    border-radius: var(--radius-md); 
    overflow: hidden; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.02); 
}
.post-image { width: 100%; height: 200px; background-size: cover; background-position: center; background-color: #E2DDD5; }
.post-content { padding: 15px; }
.post-title { font-size: 16px; margin-bottom: 10px; }
.post-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
}
textarea.form-control { min-height: 150px; resize: vertical; }

/* Ads */
.ad-container { width: 100%; display: flex; justify-content: center; margin: 15px 0; }
.ad-content { background: var(--ad-bg); border: 1px dashed var(--border-color); padding: 10px; width: 100%; max-width: 728px; text-align: center; border-radius: var(--radius-sm); }
.ad-label { font-size: 10px; color: var(--text-muted); display: block; margin-bottom: 5px; text-transform: uppercase; }
.feed-ad-break { grid-column: 1 / -1; }


/* --- Modern Header Refinements (Fully Responsive) --- */

/* 1. Fluid Brand Wrapping */
.brand-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 2. Modern User Profile Layout */
.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 10px; /* Tighter gap to save space */
}

/* 3. The Sleek User Pill */
.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
}

/* 4. Dynamic Circular Avatar */
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-color);
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    border: 1px solid var(--border-color);
    flex-shrink: 0; /* Prevents the circle from squishing */
}

/* 5. Clean Username Text */
.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 6. Refined Small Button */
.btn-sm {
    padding: 7px 16px;
    font-size: 13px;
    box-shadow: 0 2px 5px rgba(200, 155, 95, 0.2);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    white-space: nowrap; /* Prevents button text from breaking into two lines */
    flex-shrink: 0; /* Prevents button from squishing */
}

.btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(200, 155, 95, 0.3);
}

/* =========================================
   MOBILE RESPONSIVENESS (The Magic Fix)
   ========================================= */
@media (max-width: 600px) {
    /* Shrink the logo text slightly */
    .brand-text {
        font-size: 16px; 
    }
    
    /* Hide the text name, leaving ONLY the circular avatar */
    .user-name {
        display: none; 
    }
    
    /* Adjust the pill padding so it's a perfect circle on mobile */
    .user-pill {
        padding: 4px; 
        gap: 0;
    }
    
    /* Shrink the logout button slightly */
    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Ensure the main nav container doesn't overflow */
    .nav-container {
        gap: 5px;
    }
}


/* --- Profile & Settings Page --- */
.settings-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-info h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    color: var(--text-main);
}

.settings-info p {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
}

/* --- Modern Toggle Switch --- */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-gold);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* =========================================
   MOBILE BOTTOM NAVIGATION
   ========================================= */

/* Hide by default on desktop */
.bottom-nav {
    display: none; 
}

/* Only show on mobile screens */
@media (max-width: 768px) {
    /* Push the body up so content isn't hidden behind the fixed footer */
    body {
        padding-bottom: 70px; 
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--card-bg);
        border-top: 1px solid var(--border-color);
        justify-content: space-around;
        align-items: center;
        height: 65px;
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom); /* iOS gesture bar support */
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
    }

    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted); /* Greyed out by default */
        text-decoration: none;
        flex: 1;
        height: 100%;
        gap: 4px;
        transition: color 0.2s ease;
    }

    /* SVG Icon Styling */
    .nav-item svg {
        transition: transform 0.2s ease, stroke-width 0.2s ease;
    }

    /* Text Styling */
    .nav-item span {
        font-size: 11px;
        font-weight: 500;
    }

    /* Active State (The page the user is currently on) */
    .nav-item.active {
        color: var(--accent-gold); /* Highlight color */
    }

    .nav-item.active svg {
        stroke-width: 2.5; /* Makes the icon look bolder/filled */
        transform: scale(1.1); /* Slight pop effect */
    }

    /* Optional: Subtle tap effect */
    .nav-item:active {
        opacity: 0.7;
    }
}

/* Card Hover Effect for Clickable Posts */
.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.05);
}
[data-theme="dark"] .post-card:hover {
    box-shadow: 0 8px 15px rgba(0,0,0,0.4);
}


/* =========================================
   RESPONSIVE SEARCH BAR
   ========================================= */
.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 40px;
    max-width: 600px;
    width: 100%;
}

.search-input {
    flex: 1;
    min-width: 0; /* Prevents the input from overflowing its container */
    padding: 12px 20px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 15px;
}

.search-btn {
    padding: 10px 24px;
    border-radius: var(--radius-pill);
}

.clear-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    text-decoration: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Layout Magic */
@media (max-width: 500px) {
    .search-form {
        flex-wrap: wrap; /* Allows elements to drop to the next line */
    }
    
    .search-input {
        flex: 1 1 100%; /* Forces the input to take up the entire top row */
    }
    
    .search-btn, .clear-btn {
        flex: 1; /* Makes the buttons perfectly split the bottom row */
        text-align: center;
        justify-content: center;
    }
}

/* =========================================
   RESPONSIVE COMMENT FORM
   ========================================= */
.input-group {
    display: flex;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.comment-input {
    flex: 1;
    min-width: 0; /* The magic fix: Forces input to shrink instead of overflowing */
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 14px;
}

.comment-btn {
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    white-space: nowrap; /* Keeps button text on one line */
    flex-shrink: 0; /* Prevents button from getting squished */
}

/* Mobile Tweaks */
@media (max-width: 500px) {
    .comment-btn {
        padding: 10px 15px; /* Slightly tighter padding */
        font-size: 13px;
    }
    .comment-input {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* =========================================
   BRAND LOGO & HEADER RESPONSIVENESS
   ========================================= */

/* The magic circle crop and size for the logo */
.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%; /* This instantly cuts out the corners! */
    object-fit: cover;
    background-color: #fff; /* In case any transparency sneaks through */
}

/* Default Desktop View (Side by Side) */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
}

/* Mobile View (Stacked: Logo on top, text below) */
@media (max-width: 768px) {
    .brand {
        flex-direction: column; /* Stacks them vertically */
        gap: 4px; /* Tighter spacing */
        justify-content: center;
    }
    
    .brand-text {
        font-size: 14px; /* Slightly smaller text for mobile */
    }
    
    .brand-logo {
        width: 35px; /* Slightly smaller logo for mobile */
        height: 35px;
    }
}
