:root {
    --primary-color: #4361ee;
    --primary-light: #4cc9f0;
    --primary-dark: #3a0ca3;
    --secondary-color: #7209b7;
    --accent-color: #f72585;
    
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #2b2d42;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    
    --success: #2ec4b6;
    --warning: #ff9f1c;
    --danger: #e63946;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 24px rgba(67, 97, 238, 0.08);
    --shadow-lg: 0 12px 32px rgba(67, 97, 238, 0.12);
    
    --border-radius: 20px;
}

body {
    font-family: 'Prompt', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

img {
    image-orientation: from-image;
}

/* ---------------- Form Elements ---------------- */
input, select, textarea, button {
    font-family: 'Prompt', sans-serif;
}

/* Select2 overrides for font family */
.select2-container .select2-selection--single,
.select2-container .select2-search--dropdown .select2-search__field,
.select2-results__option {
    font-family: 'Prompt', sans-serif !important;
}

/* ---------------- Layout & Container ---------------- */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    background-color: var(--bg-color);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
    padding-bottom: 80px; /* Space for bottom nav */
    overflow-x: hidden;
}

/* ---------------- Header ---------------- */
.app-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    padding: 20px 24px 40px;
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
    position: relative;
    z-index: 10;
    overflow: hidden;
}

.app-header::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -30px;
    width: 200px;
    height: 200px;
    background-image: url('../../LogoMoveMeTransparent.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.12;
    z-index: 0;
    transform: rotate(15deg);
    pointer-events: none;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.header-title .header-name {
    flex: 1;
    min-width: 0;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-greeting {
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

.user-greeting .greeting-line {
    font-size: 24px;
    margin: 0 0 4px 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    min-width: 0;
}

.user-greeting .greeting-text {
    flex: 1;
    min-width: 0;
    display: block;
    white-space: nowrap;
    overflow: visible;
}

.user-greeting .greeting-star {
    flex: 0 0 auto;
    line-height: 1;
}

.fit-one-line {
    white-space: nowrap;
    overflow: visible;
    display: block;
    min-width: 0;
}

.user-greeting p {
    margin: 0;
    opacity: 0.8;
    font-size: 14px;
}

/* ---------------- Page Header ---------------- */
.page-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: calc(14px + env(safe-area-inset-top)) 20px 16px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: #ffffff;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 10px;
    border-bottom-left-radius: 26px;
    border-bottom-right-radius: 26px;
    box-shadow: var(--shadow-md);
}

.back-btn,
.page-action-btn,
.page-action-spacer {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn,
.page-action-btn {
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    text-decoration: none;
    border: none;
    padding: 0;
    font-size: 18px;
}

.page-action-btn {
    cursor: pointer;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.page-search {
    display: none;
    padding: 0 20px 16px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    margin-top: -1px;
}

.page-search.show {
    display: block;
}

.page-search-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border-radius: 18px;
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
}

.page-search-inner i {
    color: var(--text-muted);
}

.page-search-input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 14px;
    color: var(--text-main);
    background: transparent;
    min-width: 0;
}

.page-search-clear {
    border: none;
    background: transparent;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

/* ---------------- Cards & Modules ---------------- */
.module-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 20px;
    margin-top: -30px;
    position: relative;
    z-index: 20;
}

.module-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px 16px;
    text-align: center;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.module-card:hover, .module-card:active {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-md);
}

.module-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.icon-news { background: linear-gradient(135deg, #4cc9f0, #4361ee); }
.icon-activity { background: linear-gradient(135deg, #2ec4b6, #20a4f3); }
.icon-proposal { background: linear-gradient(135deg, #f72585, #7209b7); }
.icon-vote { background: linear-gradient(135deg, #ff9f1c, #ffbf69); }

.module-title {
    font-weight: 500;
    font-size: 14px;
    margin: 0;
}

/* ---------------- Bottom Navigation ---------------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 12px;
    gap: 6px;
    transition: color 0.3s;
    flex: 1;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item i {
    font-size: 20px;
    transition: transform 0.3s;
}

.nav-item.active i {
    transform: scale(1.2);
}

.nav-fab {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin-top: -30px;
    box-shadow: 0 8px 16px rgba(67, 97, 238, 0.3);
    transition: transform 0.3s;
    text-decoration: none;
    z-index: 1;
}

.nav-fab::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(#ffadad, #ffd6a5, #fdffb6, #caffbf, #9bf6ff, #a0c4ff, #bdb2ff, #ffc6ff, #ffadad);
    z-index: -2;
    animation: spinRainbow 5s linear infinite;
}

.nav-fab::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--primary-color);
    z-index: -1;
}

.nav-fab i {
    position: relative;
    z-index: 1;
}

@keyframes spinRainbow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.nav-fab:active {
    transform: scale(0.9);
}

.install-prompt {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(80px + env(safe-area-inset-bottom) + 10px);
    width: calc(100% - 40px);
    max-width: 440px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    padding: 12px;
    z-index: 120;
    display: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.install-prompt.show {
    display: flex;
}

.install-prompt .install-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    overflow: hidden;
    flex: 0 0 auto;
    background: rgba(67,97,238,0.08);
}

.install-prompt .install-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.install-prompt .install-content {
    flex: 1;
    min-width: 0;
    padding: 0 10px;
}

.install-prompt .install-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.install-prompt .install-subtitle {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.install-prompt .install-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.install-prompt .install-btn {
    border: none;
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Prompt', sans-serif;
}

.install-prompt .install-btn.primary {
    background: var(--primary-color);
    color: #ffffff;
}

.install-prompt .install-btn.ghost {
    background: rgba(67, 97, 238, 0.12);
    color: var(--primary-color);
}

.install-prompt .install-close {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: none;
    background: rgba(0,0,0,0.06);
    color: rgba(0,0,0,0.55);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.install-guide {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0,0,0,0.55);
}

.install-guide.show {
    display: flex;
}

.install-guide .guide-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 18px;
    padding: 16px;
    box-shadow: var(--shadow-lg);
}

.install-guide .guide-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
}

.install-guide .guide-steps {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    color: var(--text-main);
    font-size: 13px;
    line-height: 1.6;
}

.install-guide .guide-steps li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.install-guide .guide-steps li:last-child {
    border-bottom: none;
}

.install-guide .guide-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

/* ---------------- Lists & Items ---------------- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    margin: 24px 0 16px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.see-all {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.list-container {
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--text-main);
    transition: transform 0.2s;
    animation: slideInRight 0.5s ease-out backwards;
    animation-fill-mode: both;
}

.list-item:active {
    transform: scale(0.98);
}

/* Stagger animation delays for list items */
.list-item:nth-child(1) { animation-delay: 0.1s; }
.list-item:nth-child(2) { animation-delay: 0.2s; }
.list-item:nth-child(3) { animation-delay: 0.3s; }
.list-item:nth-child(4) { animation-delay: 0.4s; }

/* ---------------- Animations ---------------- */
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

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

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}
