
/* ==========================================================
   IQRANIX COMMUNITY
   Instagram-inspired mobile design
   Theme: White with IQRANIX Green
========================================================== */


/* =======================
   ROOT
======================= */

:root {
    --bg: #ffffff;
    --bg-secondary: #f7f7f7;
    --surface: #ffffff;
    --surface-light: #f5f5f5;

    --green: #16a36a;
    --green-light: #16a36a;
    --green-dark: #087447;

    --gold: #d5b66b;

    --text: #171717;
    --text-secondary: #777777;
    --muted: #999999;

    --border: rgba(0,0,0,0.09);

    --radius: 15px;
    --nav-height: 68px;
}


/* =======================
   RESET
======================= */

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    color: inherit;
    cursor: pointer;
    border: none;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

[hidden] {
    display: none !important;
}


/* =======================
   LOADER
======================= */

.loader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 9999;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.loader-logo {
    width: 65px;
    height: 65px;

    display: grid;
    place-items: center;

    border-radius: 20px;

    background: var(--green);
    color: white;

    font-size: 25px;
    font-weight: 800;

    box-shadow: 0 0 35px rgba(22,163,106,0.18);
}

.loader p {
    color: var(--text-secondary);
    font-size: 13px;
}


/* =======================
   AUTH REQUIRED
======================= */

#authRequired {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 25px;
    text-align: center;
}

#authRequired h2 {
    font-size: 25px;
    margin-bottom: 10px;
}

#authRequired p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

#authRequired a {
    background: var(--green);
    padding: 13px 25px;
    border-radius: 10px;
    color: white;
}


/* =======================
   COMMUNITY APP
======================= */

#communityApp {
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}


/* =======================
   TOP HEADER
======================= */

.topbar {
    height: 65px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 0 18px;

    position: sticky;
    top: 0;

    z-index: 100;

    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(15px);

    border-bottom: 1px solid var(--border);
}

.brand {
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--green);
}

.header-icon {
    width: 38px;
    height: 38px;

    background: transparent;

    display: grid;
    place-items: center;

    font-size: 25px;
    color: var(--text);
}

.header-icon:active {
    opacity: 0.6;
}


/* =======================
   PAGE SYSTEM
======================= */

main {
    width: 100%;
}

.page {
    display: none;
    width: 100%;
}

.page.active {
    display: block;
}


/* =======================
   STORIES
======================= */

.stories-section {
    width: 100%;
    overflow: hidden;

    border-bottom: 1px solid var(--border);
}

.stories-container {
    display: flex;
    gap: 16px;

    overflow-x: auto;

    padding: 17px 15px 14px;

    scrollbar-width: none;
}

.stories-container::-webkit-scrollbar {
    display: none;
}

.story-item {
    flex: 0 0 76px;
    width: 76px;

    text-align: center;
    cursor: pointer;
}

.story-item > div {
    width: 76px;
    height: 76px;

    padding: 3px;

    border-radius: 50%;

    background: linear-gradient(
        135deg,
        var(--gold),
        var(--green-light),
        var(--green-dark)
    );

    margin-bottom: 7px;
}

.story-item img {
    width: 100%;
    height: 100%;

    border-radius: 50%;

    object-fit: cover;

    border: 3px solid var(--bg);
}

.story-item p {
    font-size: 11px;
    color: var(--text-secondary);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-add-avatar {
    position: relative;
}

.story-plus {
    position: absolute;

    right: -1px;
    bottom: 0;

    width: 23px;
    height: 23px;

    border-radius: 50%;

    background: var(--green-light);
    color: white;

    border: 3px solid var(--bg);

    display: grid;
    place-items: center;

    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}


/* =======================
   CREATE POST
======================= */

.create-post-card {
    padding: 15px;
    border-bottom: 7px solid var(--bg-secondary);
}

.composer-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.composer-top img {
    width: 42px;
    height: 42px;

    border-radius: 50%;
    object-fit: cover;

    background: var(--surface);
}

.composer-top button {
    flex: 1;

    text-align: left;

    padding: 13px 16px;

    background: var(--surface-light);
    border: 1px solid var(--border);

    border-radius: 30px;

    color: var(--text-secondary);
    font-size: 13px;
}

.composer-actions {
    display: flex;
    justify-content: space-around;

    margin-top: 15px;
    padding-top: 12px;

    border-top: 1px solid var(--border);
}

.composer-actions button {
    background: transparent;

    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 600;

    display: flex;
    align-items: center;
    gap: 8px;
}

.composer-actions i {
    color: var(--green);
    font-size: 17px;
}


/* =======================
   FEED
======================= */

.feed-section {
    width: 100%;
}

.feed-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 17px 15px;
}

.feed-heading h3 {
    font-size: 17px;
    font-weight: 700;
}

.feed-heading select {
    background: var(--surface-light);
    color: var(--text-secondary);

    border: 1px solid var(--border);
    border-radius: 8px;

    padding: 8px;

    font-size: 11px;
    outline: none;
}


/* =======================
   POST CARD
======================= */

.post-card {
    width: 100%;
    margin-bottom: 10px;

    border-bottom: 7px solid var(--bg-secondary);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 11px;

    padding: 12px 14px;
}

.post-header > img {
    width: 39px;
    height: 39px;

    border-radius: 50%;
    object-fit: cover;

    padding: 2px;

    border: 2px solid var(--green);
}

.post-user-info {
    flex: 1;
    min-width: 0;
}

.post-user-info h4 {
    font-size: 13px;
    font-weight: 700;
}

.post-user-info p {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.post-menu {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px;
}

.post-content {
    padding: 5px 15px 15px;

    font-size: 14px;
    line-height: 1.7;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 23px;

    padding: 12px 15px;
    border-top: 1px solid var(--border);
}

.post-actions button {
    display: flex;
    align-items: center;
    gap: 7px;

    background: transparent;

    color: var(--text-secondary);
    font-size: 13px;
}

.post-actions button i {
    font-size: 21px;
}

.post-actions button.liked {
    color: #f16b78;
}

.empty-state {
    padding: 45px 20px;
    text-align: center;

    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.8;
}


/* ==========================================================
   PROFILE PAGE
========================================================== */

.profile-topbar {
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 20px;
}

.profile-topbar button {
    background: transparent;
    font-size: 22px;
    width: 35px;
    height: 35px;
}

.profile-topbar h2 {
    font-size: 17px;
    font-weight: 700;
}

.profile-topbar h2 i {
    font-size: 11px;
    margin-left: 5px;
}


/* =======================
   PROFILE HEADER
======================= */

.profile-header {
    padding: 13px 18px 20px;
}

.profile-main {
    display: flex;
    align-items: center;
    gap: 15px;
}

.profile-avatar-wrapper {
    width: 110px;
    height: 110px;
    flex-shrink: 0;

    border-radius: 50%;

    padding: 3px;

    background: linear-gradient(
        135deg,
        var(--gold),
        var(--green-light),
        var(--green-dark)
    );
}

.profile-avatar-wrapper img {
    width: 100%;
    height: 100%;

    border-radius: 50%;
    object-fit: cover;

    border: 3px solid var(--bg);
}

.profile-stats {
    flex: 1;

    display: flex;
    justify-content: space-around;
    gap: 8px;
}

.profile-stats div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.profile-stats strong {
    font-size: 18px;
    font-weight: 700;
}

.profile-stats span {
    font-size: 11px;
    color: var(--text-secondary);
}

.profile-bio {
    margin-top: 17px;
}

.profile-bio h3 {
    font-size: 14px;
    margin-bottom: 7px;
}

.profile-bio p {
    font-size: 13px;
    line-height: 1.7;

    color: var(--text-secondary);

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}


/* =======================
   PROFILE BUTTONS
======================= */

.profile-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 48px;
    gap: 8px;

    margin-top: 17px;
}

.profile-buttons button {
    min-height: 43px;

    background: var(--surface-light);

    border: 1px solid var(--border);
    border-radius: 9px;

    color: var(--text);

    font-size: 12px;
    font-weight: 700;
}

.profile-buttons button:last-child {
    font-size: 17px;
}

.profile-buttons button:active {
    background: #e5f5ed;
}


/* =======================
   DISCOVER PEOPLE
======================= */

.discover-section {
    padding: 15px 0 20px;

    border-top: 7px solid var(--bg-secondary);
}

.section-heading {
    padding: 0 18px 14px;
}

.section-heading h3 {
    font-size: 17px;
}

.discover-container {
    display: flex;
    gap: 10px;

    padding: 0 15px 10px;

    overflow-x: auto;
    scrollbar-width: none;
}

.discover-container::-webkit-scrollbar {
    display: none;
}

.explore-user-card {
    flex: 0 0 175px;

    min-height: 190px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 17px 12px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 15px;

    text-align: center;
}

.explore-user-card img {
    width: 76px;
    height: 76px;

    border-radius: 50%;
    object-fit: cover;

    margin-bottom: 12px;

    border: 2px solid var(--green);
}

.explore-user-card h4 {
    font-size: 12px;
    margin-bottom: 5px;
}

.explore-user-card p {
    font-size: 10px;
    color: var(--text-secondary);
}


/* =======================
   HIGHLIGHTS
======================= */

.highlights-section {
    padding: 20px 15px;

    border-top: 1px solid var(--border);
}

.highlights-container {
    display: flex;
    gap: 22px;
    overflow-x: auto;

    scrollbar-width: none;
}

.highlight-add {
    flex: 0 0 76px;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;

    background: transparent;
}

.highlight-add span {
    width: 68px;
    height: 68px;

    display: grid;
    place-items: center;

    border: 1px solid var(--text-secondary);
    border-radius: 50%;

    font-size: 22px;
}

.highlight-add small {
    font-size: 11px;
    color: var(--text-secondary);
}


/* =======================
   PROFILE TABS
======================= */

.profile-tabs {
    height: 48px;

    display: grid;
    grid-template-columns: repeat(3, 1fr);

    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.profile-tabs button {
    background: transparent;

    color: var(--muted);

    font-size: 18px;

    border-bottom: 2px solid transparent;
}

.profile-tabs button.active {
    color: var(--green);
    border-bottom-color: var(--green);
}


/* =======================
   PROFILE POSTS GRID
======================= */

.profile-posts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding-top: 2px;
}

.profile-posts .post-card {
    min-width: 0;
    min-height: 110px;

    margin: 0;
    padding: 10px;

    background: var(--surface);

    border: none;
}

.profile-posts .post-header {
    padding: 0;
    gap: 5px;
}

.profile-posts .post-header > img {
    width: 25px;
    height: 25px;
}

.profile-posts .post-user-info h4 {
    font-size: 9px;
}

.profile-posts .post-user-info p {
    display: none;
}

.profile-posts .post-menu {
    display: none;
}

.profile-posts .post-content {
    padding: 10px 0;
    font-size: 10px;

    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.profile-posts .post-actions {
    padding: 5px 0;
    gap: 9px;
}

.profile-posts .post-actions button {
    font-size: 9px;
    gap: 3px;
}

.profile-posts .post-actions button i {
    font-size: 12px;
}

.profile-posts .empty-state {
    grid-column: 1 / -1;
}


/* ==========================================================
   BOTTOM NAVIGATION
========================================================== */

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;

    width: 100%;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));

    padding: 0 10px env(safe-area-inset-bottom);

    display: flex;
    justify-content: space-around;
    align-items: center;

    background: rgba(255,255,255,0.97);

    border-top: 1px solid var(--border);

    backdrop-filter: blur(20px);

    z-index: 500;
}

.mobile-bottom-nav button,
.mobile-bottom-nav a {
    width: 48px;
    height: 48px;

    display: grid;
    place-items: center;

    background: transparent;

    color: var(--text);

    font-size: 22px;
}

.mobile-bottom-nav button.active {
    color: var(--green);
}

.mobile-bottom-nav img {
    width: 31px;
    height: 31px;

    border-radius: 50%;
    object-fit: cover;

    border: 2px solid var(--green);
}


/* ==========================================================
   MODALS
========================================================== */

.modal {
    position: fixed;
    inset: 0;

    z-index: 2000;

    background: rgba(0,0,0,0.55);

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 18px;
}

.modal-content {
    width: 100%;
    max-width: 430px;

    max-height: 90vh;
    overflow-y: auto;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 18px;

    padding: 22px;
}

.modal-content h2 {
    font-size: 19px;
    margin-bottom: 10px;
}

.modal-content > p {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 18px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 17px;
}

.modal-header h2 {
    margin: 0;
}

.modal-header button,
.story-close {
    background: transparent;
    color: var(--text);
    font-size: 21px;
}


/* =======================
   FORM ELEMENTS
======================= */

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;

    margin: 8px 0 14px;
    padding: 13px;

    border-radius: 9px;

    background: var(--bg-secondary);
    color: var(--text);

    border: 1px solid var(--border);

    outline: none;
}

.modal-content textarea {
    resize: vertical;
    line-height: 1.6;
}

.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus {
    border-color: var(--green);
}

.modal-content label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
}

.modal-content form > button {
    width: 100%;
    min-height: 45px;

    background: var(--green);
    color: white;

    border-radius: 10px;

    font-weight: 700;
}

.modal-content form > button:disabled {
    opacity: 0.6;
}

.error-message {
    color: #d93636;
    font-size: 12px;
    margin: 8px 0;
}


/* =======================
   CREATE TYPE SELECTOR
======================= */

.create-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.create-type-selector button {
    flex: 1;

    padding: 10px;

    background: var(--bg-secondary);

    border-radius: 8px;

    color: var(--text-secondary);

    font-size: 12px;
}

.create-type-selector button.active {
    background: var(--green);
    color: white;
}


/* =======================
   STORY VIEWER
======================= */

.story-modal {
    background: rgba(0,0,0,0.9);
}

.story-viewer {
    position: relative;

    width: 100%;
    max-width: 420px;
    min-height: 450px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px 20px;

    border-radius: 18px;

    background: linear-gradient(
        145deg,
        #ffffff,
        #f1f7f3
    );

    color: var(--text);

    text-align: center;
}

.story-close {
    position: absolute;
    top: 15px;
    right: 17px;
}


/* =======================
   TOAST
======================= */

.toast {
    position: fixed;

    left: 50%;
    bottom: calc(var(--nav-height) + 18px);

    transform: translate(-50%, 20px);

    z-index: 3000;

    background: var(--green-dark);
    color: white;

    padding: 12px 20px;

    border-radius: 10px;

    font-size: 12px;

    opacity: 0;
    pointer-events: none;

    transition: 0.25s ease;

    max-width: 90%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}


/* ==========================================================
   TABLET AND DESKTOP
========================================================== */

@media (min-width: 768px) {

    #communityApp {
        max-width: 700px;
        margin: auto;

        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }

    .topbar {
        height: 70px;
    }

    .brand {
        font-size: 26px;
    }

    .stories-container {
        gap: 22px;
        padding: 20px;
    }

    .story-item {
        flex-basis: 85px;
        width: 85px;
    }

    .story-item > div {
        width: 85px;
        height: 85px;
    }

    .profile-header {
        padding: 25px;
    }

    .profile-avatar-wrapper {
        width: 130px;
        height: 130px;
    }

    .profile-stats strong {
        font-size: 22px;
    }

    .profile-stats span {
        font-size: 13px;
    }

    .post-content {
        font-size: 15px;
    }

    .mobile-bottom-nav {
        left: 50%;
        transform: translateX(-50%);
        max-width: 700px;
    }

}


/* ==========================================================
   SMALL PHONES
========================================================== */

@media (max-width: 360px) {

    .brand {
        font-size: 20px;
    }

    .profile-avatar-wrapper {
        width: 88px;
        height: 88px;
    }

    .profile-stats {
        gap: 4px;
    }

    .profile-stats strong {
        font-size: 16px;
    }

    .profile-stats span {
        font-size: 10px;
    }

    .profile-buttons {
        grid-template-columns: 1fr 1fr 42px;
    }

    .profile-buttons button {
        font-size: 10px;
    }

    .mobile-bottom-nav button,
    .mobile-bottom-nav a {
        width: 42px;
        font-size: 20px;
    }

}


/* ==========================================================
   ACCESSIBILITY
========================================================== */

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 3px;
}

button:active {
    opacity: 0.8;
}
