@import url('https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@100..900&display=swap');

:root {
    --bg-0: #090c11;
    --bg-1: #111722;
    --bg-2: #171d27;
    --glass-bg: rgba(24, 30, 40, 0.72);
    --glass-bg-strong: rgba(15, 20, 28, 0.86);
    --glass-border: rgba(204, 212, 224, 0.19);
    --glass-border-soft: rgba(242, 246, 252, 0.08);
    --text-primary: #f1f4f8;
    --text-secondary: #adb5c1;
    --accent: #9aa8ba;
    --accent-strong: #bac5d3;
    --accent-soft: rgba(162, 173, 188, 0.2);
    --danger: #c89098;
    --radius-xl: 26px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --shadow-lg: 0 22px 72px rgba(0, 0, 0, 0.58);
    --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.46);
}

* {
    box-sizing: border-box;
}

@keyframes glassFloat {
    0% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(0, -10px, 0);
    }
    100% {
        transform: translate3d(0, 0, 0);
    }
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    position: relative;
    font-family: "Lexend Deca", Arial, sans-serif;
    color: var(--text-primary);
    background:
        radial-gradient(circle at 18% 14%, rgba(80, 96, 122, 0.2), transparent 42%),
        radial-gradient(circle at 82% 16%, rgba(62, 72, 90, 0.16), transparent 46%),
        linear-gradient(145deg, var(--bg-0), var(--bg-1) 44%, var(--bg-2));
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(50px);
    z-index: 0;
}

body::before {
    width: 420px;
    height: 420px;
    left: -160px;
    top: 120px;
    background: rgba(78, 98, 126, 0.16);
    animation: glassFloat 18s ease-in-out infinite;
}

body::after {
    width: 480px;
    height: 480px;
    right: -190px;
    bottom: 30px;
    background: rgba(64, 75, 95, 0.14);
    animation: glassFloat 22s ease-in-out infinite reverse;
}

body.app-dashboard {
    padding: 16px;
}

body.app-form-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 28px 14px;
}

.wrapper,
.form-page-wrapper {
    position: relative;
    z-index: 1;
}

.wrapper {
    width: 100%;
    max-width: 1540px;
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(28, 35, 46, 0.9), rgba(20, 26, 36, 0.8));
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px) saturate(120%);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
}

.header-right {
    gap: 12px;
}

.user-info {
    display: none;
}

.header-title h1 {
    margin: 0;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    font-size: 1.6rem;
    line-height: 1;
    letter-spacing: 0.02em;
    font-weight: 700;
    color: #edf1f6;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.title-main,
.title-subber {
    display: inline-block;
}

.title-subber {
    position: relative;
    padding-right: 24px;
}

.version-pill {
    position: absolute;
    top: -0.42em;
    right: -0.12em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 0.52rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    color: #bfc9d6;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.create-project-button,
.project-actions .action-button,
.project-actions .edit-button,
.project-actions button,
.project-actions select,
.form-container button {
    border: 1px solid rgba(153, 214, 255, 0.28);
    border-radius: 11px;
    padding: 10px 14px;
    background: linear-gradient(140deg, rgba(64, 74, 89, 0.78), rgba(44, 52, 66, 0.86));
    color: #edf1f6;
    text-decoration: none;
    font-family: "Lexend Deca", Arial, sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.create-project-button:hover,
.project-actions .action-button:hover,
.project-actions .edit-button:hover,
.project-actions button:hover,
.project-actions select:hover,
.form-container button:hover {
    transform: translateY(-1px);
    border-color: rgba(220, 228, 238, 0.52);
    background: linear-gradient(130deg, rgba(80, 92, 110, 0.86), rgba(54, 64, 79, 0.9));
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
}

.logout-button {
    background: rgba(36, 45, 58, 0.82);
    border-color: rgba(182, 193, 207, 0.3);
}

.filter-bar {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    min-height: 42px;
}

.filter-toggle {
    display: inline-flex;
    border-radius: 12px;
    padding: 4px;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border-soft);
}

.filter-btn {
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 9px;
    font-size: 0.86rem;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.filter-btn:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.07);
}

.filter-btn.active {
    color: #f4f7fb;
    background: linear-gradient(145deg, rgba(100, 117, 141, 0.84), rgba(72, 85, 103, 0.86));
}

.filter-select,
.form-container input,
.form-container select {
    width: 100%;
    border-radius: 11px;
    border: 1px solid rgba(166, 213, 255, 0.28);
    background: rgba(7, 15, 26, 0.72);
    color: #f3f9ff;
    font-family: "Lexend Deca", Arial, sans-serif;
    font-size: 0.9rem;
    padding: 10px 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.filter-select {
    width: auto;
    min-width: 220px;
    padding-right: 34px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2724%27%20height%3D%2724%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27%23dce7f2%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpolyline%20points%3D%276%209%2012%2015%2018%209%27/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 14px;
}

.filter-select:focus,
.form-container input:focus,
.form-container select:focus {
    outline: none;
    border-color: rgba(118, 207, 255, 0.76);
    box-shadow: 0 0 0 3px rgba(53, 159, 255, 0.2);
    background: rgba(13, 24, 39, 0.82);
}

.projects-list {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 14px;
}

.project-card {
    display: flex;
    flex-direction: column;
    min-height: 500px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(130%);
    box-shadow: var(--shadow-lg);
    padding: 14px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
    transform: translateY(-3px);
    border-color: rgba(220, 228, 238, 0.36);
}

.project-card img {
    width: 100%;
    height: 320px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid rgba(177, 220, 255, 0.2);
    margin-bottom: 14px;
}

.project-info {
    flex: 1 1 auto;
}

.project-info h2 {
    margin: 0 0 10px;
    font-size: 1.16rem;
    line-height: 1.35;
}

.project-info p {
    margin: 0 0 9px;
    color: var(--text-secondary);
    line-height: 1.4;
    font-size: 0.87rem;
}

.project-info p strong {
    color: #d8e1eb;
}

.project-actions {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.project-actions a,
.project-actions button,
.project-actions select {
    width: 100%;
    text-align: center;
}

.project-actions select {
    padding-right: 30px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2724%27%20height%3D%2724%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27%23dce7f2%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpolyline%20points%3D%276%209%2012%2015%2018%209%27/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

.project-actions .edit-button {
    border-color: rgba(148, 196, 246, 0.36);
}

.project-actions .delete-button {
    border-color: rgba(221, 162, 172, 0.42);
    background: linear-gradient(140deg, rgba(104, 53, 63, 0.72), rgba(75, 39, 46, 0.82));
}

.project-actions .delete-button:hover {
    background: linear-gradient(130deg, rgba(123, 66, 76, 0.78), rgba(88, 46, 54, 0.88));
}

.activity-card {
    border-color: rgba(169, 219, 255, 0.28);
}

.activity-card h2 {
    margin: 2px 0 14px;
    font-size: 1rem;
    color: #dde8f5;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 52px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 2px;
}

.activity-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid var(--glass-border-soft);
    background: rgba(10, 18, 29, 0.68);
}

.activity-entry img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 1px solid rgba(177, 188, 204, 0.62);
    object-fit: cover;
}

.activity-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.activity-user-name {
    font-weight: 700;
    color: #ecf4ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-location {
    font-size: 0.74rem;
    color: #b2bfce;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-projects-message,
.no-activity-message {
    text-align: center;
    color: var(--text-secondary);
    border-radius: 12px;
    border: 1px dashed rgba(175, 184, 198, 0.32);
    background: rgba(9, 15, 24, 0.5);
    padding: 18px;
}

.form-page-wrapper {
    width: min(760px, 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(28, 35, 46, 0.9), rgba(20, 26, 36, 0.8));
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
}

.form-header h1 {
    margin: 0;
    font-size: 1.2rem;
    letter-spacing: 0.02em;
}

.form-header .back-link,
.form-footer-link a {
    color: #dbe6f5;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
}

.form-header .back-link:hover,
.form-footer-link a:hover {
    text-decoration: underline;
}

.form-container {
    width: 100%;
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(130%);
    box-shadow: var(--shadow-lg);
    padding: 24px;
}

.form-container h2 {
    margin: 0 0 18px;
    text-align: center;
    font-size: 1.2rem;
}

.form-container label {
    display: block;
    margin: 14px 0 7px;
    color: #d6e1ee;
    font-size: 0.86rem;
    font-weight: 600;
}

.form-container input,
.form-container select {
    margin: 0 0 6px;
}

.form-container select[multiple] {
    min-height: 132px;
    resize: vertical;
}

.form-container input[type="file"] {
    padding: 8px;
}

.form-container button {
    width: 100%;
    margin-top: 8px;
}

.form-muted,
.note {
    margin: 6px 0 0;
    color: #b2bfce;
    font-size: 0.78rem;
}

.divider-text {
    margin: 10px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.form-footer-link {
    margin: 14px 0 0;
    text-align: center;
}

.current-cover {
    margin-top: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--glass-border-soft);
    border-radius: var(--radius-md);
    background: rgba(10, 17, 28, 0.56);
    padding: 10px;
    display: inline-flex;
}

.current-cover img {
    max-width: min(260px, 100%);
    border-radius: 10px;
    display: block;
}

.episode-container {
    margin-top: 8px;
}

::selection {
    background: rgba(94, 199, 255, 0.34);
    color: #f8fdff;
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(147, 202, 246, 0.58) rgba(6, 12, 21, 0.6);
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: rgba(5, 10, 18, 0.58);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(111, 193, 255, 0.75), rgba(67, 140, 206, 0.78));
    border: 2px solid rgba(5, 10, 18, 0.45);
    border-radius: 999px;
}

@media (max-width: 1100px) {
    .project-card {
        min-height: 480px;
    }

    .project-card img {
        height: 280px;
    }
}

@media (max-width: 900px) {
    body.app-dashboard {
        padding: 12px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
    }

    .button-group {
        width: 100%;
    }

    .create-project-button {
        flex: 1 1 auto;
        text-align: center;
    }

    .filter-bar {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .filter-select {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 620px) {
    body.app-form-page {
        padding: 16px 10px;
    }

    .form-container {
        padding: 18px;
    }

    .form-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .projects-list {
        grid-template-columns: 1fr;
    }

    .project-card {
        min-height: 420px;
    }

    .project-card img {
        height: 220px;
    }
}

/* =========================================
   10. IO PORTAL AND USER PAGES
   ========================================= */
@keyframes bounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.portal-page {
    padding: 16px;
}

.portal-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: calc(100vh - 32px);
}

.portal-header {
    flex-wrap: wrap;
    gap: 12px;
}

.portal-logo {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #eaf1fb;
}

.portal-logo .io-wrapper span {
    display: inline-block;
    animation: bounce 1s ease-in-out 2 both;
}

.portal-logo .io-wrapper span:nth-child(1) { animation-delay: 0s; }
.portal-logo .io-wrapper span:nth-child(2) { animation-delay: 0.1s; }
.portal-logo .io-wrapper span:nth-child(3) { animation-delay: 0.2s; }

.header-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.portal-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10px 4px 22px;
}

.welcome-title {
    margin: 0;
    font-size: clamp(2rem, 5.2vw, 3.5rem);
    line-height: 1.08;
    color: #f0f4fa;
}

.header-username {
    color: #dce8f8;
}

.welcome-subtitle {
    margin: 10px 0 28px;
    color: var(--text-secondary);
    font-size: clamp(1rem, 2.4vw, 1.3rem);
}

.app-grid {
    width: 100%;
    max-width: 1200px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}

.app-card {
    min-height: 152px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(130%);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    color: #ecf4ff;
    padding: 16px 14px;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.app-card:hover {
    transform: translateY(-3px);
    border-color: rgba(220, 228, 238, 0.45);
    background: rgba(30, 40, 54, 0.78);
}

.app-card i {
    font-size: 1.65rem;
    color: #cad6e6;
}

.app-card span {
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.3;
}

.auth-page-wrapper {
    max-width: 460px;
}

.auth-form-container {
    padding-top: 20px;
}

.auth-error {
    margin: 0 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(208, 149, 159, 0.48);
    background: rgba(95, 36, 47, 0.4);
    color: #f5d3d9;
    padding: 10px 12px;
    font-size: 0.86rem;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 14px;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.auth-remember input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: #9ca9bb;
}

.users-page .users-wrapper {
    max-width: 1320px;
}

.users-header {
    margin-bottom: 14px;
}

.users-title {
    margin: 0;
    font-size: 1.34rem;
}

.users-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.user-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.user-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(130%);
    box-shadow: var(--shadow-md);
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.user-card img {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(177, 188, 204, 0.62);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.user-card h3 {
    margin: 12px 0 2px;
}

.user-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.user-card .role {
    display: inline-flex;
    margin-top: 10px;
    border-radius: 999px;
    border: 1px solid rgba(173, 184, 198, 0.36);
    padding: 4px 10px;
    color: #dae3ef;
    background: rgba(40, 50, 64, 0.74);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.user-card .actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
}

.user-card .action-button {
    border: 1px solid rgba(153, 214, 255, 0.28);
    border-radius: 11px;
    padding: 8px 12px;
    background: linear-gradient(140deg, rgba(64, 74, 89, 0.78), rgba(44, 52, 66, 0.86));
    color: #edf1f6;
    text-decoration: none;
    font-family: "Lexend Deca", Arial, sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.user-card .delete-button {
    border-color: rgba(221, 162, 172, 0.42);
    background: linear-gradient(140deg, rgba(104, 53, 63, 0.72), rgba(75, 39, 46, 0.82));
}

.user-card .action-button:hover {
    border-color: rgba(220, 228, 238, 0.52);
    background: linear-gradient(130deg, rgba(80, 92, 110, 0.86), rgba(54, 64, 79, 0.9));
}

.user-card .delete-button:hover {
    background: linear-gradient(130deg, rgba(123, 66, 76, 0.78), rgba(88, 46, 54, 0.88));
}

.user-edit-form input:read-only,
.user-edit-form select:disabled {
    background: rgba(30, 36, 45, 0.82);
    color: #8f9daf;
    border-color: rgba(141, 151, 166, 0.32);
    cursor: not-allowed;
}

@media (max-width: 820px) {
    .portal-page {
        padding: 12px;
    }

    .portal-wrapper {
        min-height: calc(100vh - 24px);
    }

    .portal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-buttons {
        width: 100%;
    }

    .header-buttons .create-project-button {
        flex: 1 1 auto;
        text-align: center;
    }
}
