:root {
    --bg-color: #0f1014;
    --surface-color: #1a1b22;
    --surface-hover: #23252d;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --border-color: #2d2f39;
    
    --premium-gradient: linear-gradient(135deg, #ff3366 0%, #ff9933 100%);
    --premium-glow: rgba(255, 51, 102, 0.4);
    --primary-color: #ffffff;
    --primary-text: #000000;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* Prevents horizontal scroll on mobile */
}

/* ================= HEADER ================= */
.site-header {
    position: sticky;
    top: 0;
    background: rgba(15, 16, 20, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    padding: 0.75rem 1rem;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0; /* Allows truncation if needed */
}

.profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    background: var(--premium-gradient);
    padding: 2px;
    flex-shrink: 0;
}

.brand h1 {
    /* Fluid typography: scales nicely between mobile and desktop */
    font-size: clamp(1rem, 3vw, 1.1rem); 
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================= BUTTONS ================= */
.auth-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

button {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    outline: none;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}

.btn-ghost:hover {
    color: var(--text-primary);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--primary-text);
    padding: 8px 20px;
}

.btn-primary:hover {
    background: #e5e5e5;
}

/* Conversion Optimized Premium Button */
.btn-premium {
    background: var(--premium-gradient);
    color: white;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px var(--premium-glow);
    position: relative;
    overflow: hidden;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--premium-glow);
}

.btn-premium.large-btn {
    padding: 12px 28px;
    font-size: clamp(0.9rem, 4vw, 1rem);
    margin-top: 15px;
    width: 100%;
    justify-content: center;
}

/* ================= FEED & POSTS ================= */
.feed-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.post-card {
    background: var(--surface-color);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.post-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4/5; 
    background: #000;
    overflow: hidden;
}

.post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.post-content {
    padding: 1rem;
}

.caption {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.post-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ====== PREMIUM LOCKED POST (CONVERSION FOCUS) ====== */
.post-image.blurry {
    filter: blur(25px);
    transform: scale(1.1);
}

.premium-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 16, 20, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
}

.overlay-content {
    background: rgba(26, 27, 34, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    padding: clamp(1.5rem, 5vw, 2.5rem) clamp(1rem, 4vw, 2rem);
    border-radius: 20px;
    width: 100%;
    max-width: 320px;
    animation: floatIn 0.8s ease-out forwards;
}

@keyframes floatIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.lock-icon {
    font-size: clamp(2rem, 6vw, 2.5rem);
    background: var(--premium-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
}

.overlay-content h2 {
    font-size: clamp(1.2rem, 5vw, 1.4rem);
    margin-bottom: 8px;
}

.overlay-content p {
    font-size: clamp(0.85rem, 3vw, 0.9rem);
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 10px;
}

/* ================= AUTH MODAL (FANCY UI) ================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--surface-color);
    width: 100%;
    max-width: 400px;
    border-radius: 24px;
    padding: clamp(1.5rem, 5vw, 2.5rem);
    position: relative;
    border: 1px solid var(--border-color);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto; /* Prevents cutoff on very small vertical screens */
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--surface-hover);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: var(--text-primary);
    background: #363845;
}

.modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-profile {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.auth-tabs {
    display: flex;
    background: var(--bg-color);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 8px;
}

.tab-btn.active {
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.auth-form {
    display: none;
}

.auth-form.active-form {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.input-group {
    position: relative;
    margin-bottom: 1rem;
}

.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.input-group input {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 14px 16px 14px 45px;
    border-radius: 12px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    border-color: #ff3366;
}

.full-width {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    border-radius: 12px;
    margin-top: 10px;
}

/* ================= TOAST NOTIFICATIONS ================= */
#toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface-color);
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border-left: 4px solid transparent;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }
.toast.success i { color: #10b981; }
.toast.error i { color: #ef4444; }

.premium-badge {
    background: linear-gradient(45deg, #ffd700, #ff8c00);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.premium-badge i {
    font-size: 0.9rem;
}
/* ================= MEDIA QUERIES (RESPONSIVE) ================= */

/* Tablet & Large Mobile */
@media (max-width: 768px) {
    .btn-ghost, .btn-primary {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    .btn-premium {
        padding: 6px 16px;
        font-size: 0.85rem;
    }
    .profile-pic {
        width: 36px;
        height: 36px;
    }
}

/* Small Mobile (Smartphones) */
@media (max-width: 600px) {
    /* Edge-to-edge feed on mobile (Instagram style) */
    .feed-container {
        margin: 1rem auto;
        padding: 0;
        gap: 1.5rem;
    }
    
    .post-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    /* Adjust header spacing */
    .header-content {
        padding: 0 0.5rem;
    }
    .auth-actions {
        gap: 8px;
    }
    
    /* Make toasts full width on bottom */
    #toast-container {
        bottom: 20px;
        left: 20px;
        right: 20px;
        align-items: center;
    }
    
    .toast {
        width: 100%;
        justify-content: center;
        /* Slide up from bottom on mobile instead of from right */
        transform: translateY(120%); 
    }
    
    .toast.show {
        transform: translateY(0);
    }
}

/* Extra Small Devices */
@media (max-width: 400px) {
    /* Hide the "Log out" text, show only minimal padding or convert to icon if needed */
    .btn-ghost {
        padding: 6px 8px;
    }
    
    /* Shrink the premium button slightly */
    .btn-premium {
        padding: 6px 12px;
    }
    
    .overlay-content {
        padding: 1.25rem 1rem;
    }
}