:root {
    --primary-color: #6a11cb;
    --secondary-color: #2575fc;
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --input-bg: rgba(255, 255, 255, 0.05);

    /* Default Feed Theme (Dark) */
    --feed-bg: #000000;
    --card-bg: #121212;
    --card-border: #363636;
    --text-main: #fafafa;
    --text-sub: #a8a8a8;
    --card-shadow: rgba(0, 0, 0, 0.5);
    --header-border: #363636;
    --img-bg: #000;
}

/* Light Theme Override */
body.theme-light {
    --feed-bg: #fafafa;
    --card-bg: #ffffff;
    --card-border: #dbdbdb;
    --text-main: #262626;
    --text-sub: #8e8e8e;
    --card-shadow: rgba(0, 0, 0, 0.1);
    --header-border: #efefef;
    --img-bg: #fafafa;
}


body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    animation: fadeIn 0.8s ease-out;
    position: relative;
    z-index: 1;
}

/* Top Bar */
.top-bar {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    font-size: 1.2em;
    transition: all 0.3s;
    text-decoration: none;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: rgba(255, 255, 255, 0.9);
    /* Opaque for readability */
    color: #333;
    /* Dark text for contrast on white */
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 350px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease;
}

.modal-content input {
    background: #f0f0f0;
    /* Light styling for logic inside modal */
    color: #333;
    border: 1px solid #ccc;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5em;
    cursor: pointer;
    color: #666;
}

h1,
h2,
h3 {
    margin-top: 0;
    text-align: center;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9em;
    opacity: 0.8;
}

input {
    width: 100%;
    padding: 12px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    font-size: 1em;
    outline: none;
    box-sizing: border-box;
    /* Fix padding issue */
    transition: all 0.3s ease;
}

input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: white;
    color: var(--secondary-color);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.message {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    border-radius: 10px;
    font-size: 0.9em;
}

.error {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid rgba(255, 0, 0, 0.3);
}

.success {
    background: rgba(0, 255, 0, 0.2);
    border: 1px solid rgba(0, 255, 0, 0.3);
}

.dashboard-links {
    margin-top: 30px;
    display: grid;
    gap: 15px;
}

.link-card {
    display: block;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    text-decoration: none;
    color: white;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.link-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Layout */
.layout-wrapper {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 245px;
    border-right: 1px solid var(--header-border);
    padding: 24px 12px 120px 12px;
    /* Lift "More" button significantly higher */
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo {
    font-family: 'Inter', sans-serif;
    /* Ideally "Billabong" or similar script font */
    font-size: 24px;
    margin-bottom: 30px;
    padding: 10px;
    font-weight: 600;
    margin-top: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-main);
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    /* Works for dark mode mostly */
}

body.theme-light .nav-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.nav-item.active {
    font-weight: bold;
}

.nav-icon {
    font-size: 24px;
    margin-right: 16px;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 16px;
}

.nav-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #555;
    margin-right: 16px;
    /* Match .nav-icon spacing */
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 630px;
    margin: 0 auto;
    padding-top: 24px;
}

/* Stories */
.stories-container {
    display: flex;
    gap: 15px;
    padding: 10px 0;
    margin-bottom: 20px;
    overflow-x: auto;
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 66px;
}

.story-ring {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    padding: 2px;
    margin-bottom: 6px;
}

.story-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--card-bg);
    /* Use background to create border effect */
    border: 2px solid var(--card-bg);
    /* Inner gap */
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9IiM1NTUiIC8+PC9zdmc+');
    /* Placeholder */
    background-size: cover;
}

.story-user {
    font-size: 12px;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    text-align: center;
}


/* Right Column */
.right-column {
    width: 320px;
    padding: 24px 0 24px 30px;
    display: none;
    /* Hide on smaller screens */
}

@media (min-width: 1100px) {
    .right-column {
        display: block;
    }
}

/* Updated Feed CSS */
.insta-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    /* Slightly rounded */
    margin-bottom: 20px;
    padding: 0;
    box-shadow: none;
    /* Web visual usually has specific borders, shadow less prominent in dark mode */

    /* Animation Properties */
    opacity: 1;
    max-height: 2000px;
    /* Large enough to fit content */
    transform: translateY(0);
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    /* Smooth ease-out */
    overflow: hidden;
}

.insta-card.hidden {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    transform: translateY(-50px) scale(0.95);
    border-width: 0;
}


.insta-header {
    padding: 14px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--header-border);
}

.insta-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    margin-right: 12px;
}

.insta-user {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    flex-grow: 1;
}

.insta-time {
    font-size: 12px;
    color: var(--text-sub);
    display: none;
    /* Hidden in header usually on new layout, shown in footer */
}

.insta-img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 800px;
    /* Taller max height */
    object-fit: contain;
    background: var(--img-bg);
    border-top: 1px solid var(--card-border);
    /* Sometimes useful */
    border-bottom: 1px solid var(--card-border);
}

.insta-footer {
    padding: 12px 16px;
    color: var(--text-main);
}

/* Actions */
.insta-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.action-left,
.action-right {
    display: flex;
    gap: 16px;
}

.action-icon {
    font-size: 24px;
    cursor: pointer;
}

.action-icon:hover {
    opacity: 0.7;
}

.insta-likes {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}

.insta-caption-block {
    font-size: 14px;
    line-height: 1.5;
}

.insta-caption-user {
    font-weight: 600;
    margin-right: 6px;
    font-size: 14px;
}

.insta-caption {
    font-size: 14px;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    .container {
        padding: 15px;
        max-width: 100%;
    }

    .glass-card {
        padding: 25px 20px;
        border-radius: 15px;
    }

    /* Increase touch targets */
    button,
    input,
    .nav-item,
    .admin-link,
    .action-icon {
        min-height: 44px;
    }

    /* Stack flex containers on small screens */
    .session-card {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    .session-info {
        width: 100%;
    }

    .session-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }

    h2 {
        font-size: 1.5rem;
    }

    /* Feed Layout Mobile */
    .sidebar {
        display: none !important;
    }

    .main-content {
        padding-top: 60px;
        /* Space for top bar */
        padding-bottom: 60px;
        /* Space for bottom bar */
        width: 100%;
        max-width: 100%;
    }

    .feed-container {
        margin: 0 auto;
        padding-bottom: 10px;
    }

    .mobile-top-bar {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 50px;
        background: var(--feed-bg);
        border-bottom: 1px solid var(--header-border);
        z-index: 100;
        align-items: center;
        justify-content: space-between;
        padding: 0 15px;
    }

    .mobile-logo {
        font-family: 'Inter', sans-serif;
        font-weight: 600;
        font-size: 1.2rem;
    }

    .mobile-bottom-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50px;
        background: var(--feed-bg);
        border-top: 1px solid var(--header-border);
        z-index: 100;
        align-items: center;
        justify-content: space-around;
    }

    .mobile-nav-item {
        font-size: 24px;
        color: var(--text-main);
        text-decoration: none;
    }
}

/* Default hidden for desktop */
.mobile-top-bar,
.mobile-bottom-bar {
    display: none;
}