:root {
    --primary: #10b981;
    --primary-hover: #059669;
    --secondary: #3b82f6;
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --glass-blur: 12px;
    --radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: radial-gradient(circle at top right, #1e293b, var(--bg-color));
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Typography & Utilities */
h1,
h2,
h3,
h4 {
    font-weight: 600;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-sm {
    font-size: 0.875rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Auth Screen */
#auth-screen {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    text-align: center;
}

.brand-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.5));
}

.auth-box {
    padding: 2rem;
    margin-top: 2rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    color: white;
    outline: none;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.switch-auth {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.switch-auth a {
    color: var(--primary);
    text-decoration: none;
}

/* Main Layout */
#main-screen {
    width: 100vw;
    height: 100vh;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100vh;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--panel-border);
    border-radius: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.sidebar-brand .brand-icon {
    font-size: 2rem;
    margin-bottom: 0;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    transition: var(--transition);
    position: relative;
}

.nav-links li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-links li.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

.badge {
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    position: absolute;
    right: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--panel-border);
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.user-info p {
    margin: 0;
}

.user-name {
    font-weight: 600;
}

.user-status {
    font-size: 0.8rem;
}

.logout-btn {
    margin-left: auto;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    color: var(--danger);
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.balance-card {
    padding: 0.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.balance-card .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.balance-card .amount {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--success);
}

/* Dashboard View */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    font-size: 2.5rem;
    background: rgba(255, 255, 255, 0.05);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-info h3 {
    font-size: 1.5rem;
    margin-top: 0.5rem;
}

.section-title {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.5rem;
}

/* Cycle Cards */
.cycle-card {
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.cycle-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.cycle-amounts {
    display: flex;
    gap: 2rem;
}

.cycle-amounts div p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cycle-amounts div h4 {
    font-size: 1.2rem;
}

.progress-container {
    margin-top: 1rem;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #34d399);
    width: 0%;
    transition: width 1s ease;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    color: var(--text-muted);
}

/* Announcement Marquee */
.marquee-container {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    padding: 0.8rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.marquee-content {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 20s linear infinite;
    color: var(--warning);
    font-weight: bold;
    font-size: 1.1rem;
}

@keyframes marquee {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* Contribute View */
.contribute-container {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-top: 2rem;
}

.form-group label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 500;
}

.amount-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.amount-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    color: white;
    padding: 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.amount-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.amount-btn.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: bold;
}

.plan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.plan-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.plan-card:hover {
    transform: translateY(-5px);
}

.plan-card.active {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.05);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.plan-header {
    padding: 1rem;
    border-bottom: 1px solid var(--panel-border);
    font-weight: 600;
    text-align: center;
}

.plan-body {
    padding: 1.5rem;
    text-align: center;
}

.plan-body h2 {
    color: var(--success);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.contribution-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-row:last-child {
    border: none;
    font-size: 1.2rem;
}

/* Match Card */
.match-card {
    padding: 1.5rem;
    border-left: 4px solid var(--warning);
    margin-bottom: 1rem;
}

.match-card.approved {
    border-left-color: var(--success);
}

.match-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.beneficiary-info {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.timer {
    color: var(--danger);
    font-weight: bold;
}

/* Referrals */
.link-box {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.link-box input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    color: var(--primary);
    padding: 0.75rem;
    border-radius: var(--radius);
    outline: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
}

.upload-zone {
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 3rem 1rem;
    text-align: center;
    margin-top: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(16, 185, 129, 0.05);
}

.upload-zone:hover {
    background: rgba(16, 185, 129, 0.1);
}

.upload-zone i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 2rem;
    border-radius: var(--radius);
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    #main-screen {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--panel-border);
        padding: 1rem;
    }

    .nav-links {
        display: flex;
        overflow-x: auto;
        margin-bottom: 0;
    }

    .nav-links li {
        white-space: nowrap;
    }

    .sidebar-brand {
        margin-bottom: 1rem;
    }

    .user-profile {
        display: none;
    }
}

/* Admin Styles */
.p-4 {
    padding: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    color: var(--text-main);
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--panel-border);
}

.admin-table th {
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
    position: sticky;
    top: 0;
    background: #1e293b;
    z-index: 10;
}

.admin-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.admin-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    color: white;
    margin-top: 0.5rem;
}

.admin-input option {
    background: var(--bg-color);
}

.proof-img-sm {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--panel-border);
}

.action-btns {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 4px;
}

.table-responsive {
    overflow-x: auto;
    max-height: 350px;
    overflow-y: auto;
}

/* Messages Styles */
.messages-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.message-item {
    padding: 1rem;
    border-bottom: 1px solid var(--panel-border);
    transition: var(--transition);
}

.message-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.message-sender {
    font-weight: 600;
    color: var(--primary);
}

.message-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.message-body {
    line-height: 1.5;
}

.my-message {
    background: rgba(16, 185, 129, 0.05);
    border-right: 4px solid var(--primary);
    border-bottom: none;
}

/* Global Ticker Animation */
@keyframes ticker {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

.ticker-wrap {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
    position: relative;
}

.ticker-move {
    display: inline-block;
    white-space: nowrap;
    animation: ticker 25s linear infinite;
    will-change: transform;
}

.ticker-move:hover {
    animation-play-state: paused;
}

.ticker-item {
    display: inline-block;
    font-size: 0.95rem;
    color: var(--text-main);
}

/* Custom Scrollbar inside Documentation Reader Area */
.doc-reader-area::-webkit-scrollbar {
    width: 6px;
}
.doc-reader-area::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}
.doc-reader-area::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.3);
    border-radius: 4px;
}
.doc-reader-area::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.5);
}

/* Custom Scrollbar for TOC Sidebar */
.doc-toc-sidebar::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
.doc-toc-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}
.doc-toc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.2);
    border-radius: 4px;
}
.doc-toc-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.4);
}

/* Sidebar Table of Contents Buttons */
.doc-toc-btn {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    padding: 10px 12px;
    border-radius: 8px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-toc-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: white;
}

.doc-toc-btn.active {
    background: rgba(16, 185, 129, 0.1) !important;
    color: var(--primary) !important;
    font-weight: 600;
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
}

/* Document Reader Area Heading Styles */
.doc-reader-area h3 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-reader-area h4 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

.doc-reader-area p {
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.doc-reader-area ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
}

.doc-reader-area li {
    margin-bottom: 0.5rem;
}

/* Custom layout styling on mobile responsive */
.doc-back-to-toc {
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--primary);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1.5rem;
    width: fit-content;
    transition: var(--transition);
}

.doc-back-to-toc:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .doc-body-layout {
        flex-direction: column !important;
        overflow-y: auto !important;
        position: relative;
    }
    
    .doc-back-to-toc {
        display: flex;
    }
    
    /* Toggle screens based on reader-active class */
    .doc-body-layout:not(.reader-active) .doc-toc-sidebar {
        display: flex !important;
        width: 100% !important;
        height: auto !important;
        border-right: none !important;
        padding-right: 0 !important;
        flex-direction: column !important;
        overflow-y: auto !important;
    }
    
    .doc-body-layout:not(.reader-active) .doc-reader-area {
        display: none !important;
    }
    
    .doc-body-layout.reader-active .doc-toc-sidebar {
        display: none !important;
    }
    
    .doc-body-layout.reader-active .doc-reader-area {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        padding-right: 0 !important;
    }
    
    .doc-toc-btn {
        width: 100% !important;
        padding: 12px 15px !important;
        border-radius: 8px !important;
        border-bottom: 1px solid rgba(255,255,255,0.03) !important;
        background: rgba(255,255,255,0.01) !important;
        margin-bottom: 5px;
    }
    
    .doc-toc-btn.active {
        border-left: 3px solid var(--primary) !important;
        background: rgba(16, 185, 129, 0.1) !important;
        border-radius: 0 8px 8px 0 !important;
    }
}