:root {
    /* Dark theme (default) */
    --bg-color: #1a1a1a;
    --card-bg: #262626;
    --text-color: #e0e0e0;
    --header-bg: linear-gradient(to bottom, #3d2b1f, #1a1a1a);
    --input-bg: #333;
    --input-border: #404040;
    --slider-bg: #333;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --progress-bg: #333;
    --progress-fill: #4CAF50;
}

:root[data-theme="light"] {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --header-bg: linear-gradient(to bottom, #3d2b1f, #1a1a1a);
    --input-bg: #ffffff;
    --input-border: #dddddd;
    --slider-bg: #eef2f7;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --progress-bg: #eef2f7;
    --progress-fill: #4CAF50;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

/* Header */
header {
    background: var(--header-bg);
    color: white;
    padding: .0rem;
    text-align: center;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.server-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto 1.5rem;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.stat-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mc-online .stat-icon {
    margin-top: 2px;
    transform: scale(0.9);
}

.mc-online .stat-icon path,
.discord-online .stat-icon path {
    fill: #4CAF50;
}

.discord-online .stat-icon {
    transform: scale(0.85);
    margin-top: 1px;
}

.logo img {
    height: 230px;
    width: auto;
    margin: 0 2rem;
    transform: scale(1.2);
    transition: transform 0.5s;
}

.logo img:hover {
    transform: scale(1.05);
}

.stat-value {
    font-weight: bold;
    color: #4CAF50;
    transition: background-color 0.5s;
}

@keyframes update-flash {
    0% {
        background-color: rgba(76, 175, 80, 0);
    }
    50% {
        background-color: rgba(76, 175, 80, 0.3);
    }
    100% {
        background-color: rgba(76, 175, 80, 0);
    }
}

.update-flash {
    animation: update-flash 0.5s ease-in-out;
    border-radius: 4px;
}

.copy-btn {
    margin-left: 0.5rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    position: relative;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.copy-btn .tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.copy-btn:hover .tooltip {
    opacity: 1;
}

header .tagline {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Main Layout */
.store-container {
    display: grid;
    grid-template-columns: 300px 2fr 300px;
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.store-content {
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 16px var(--shadow-color);
}

h2 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

/* Player Input */
.player-input {
    text-align: center;
    margin-bottom: -1rem;
    margin-top: -1rem;
}

.player-input input {
    text-align: center;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: block;
    padding: 1rem;
    font-size: 1rem;
    color: var(--text-color);
    background-color: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 4px;
    margin-top: 0.5rem;
    transition: all 0.3s;
}

.player-input input:focus {
    outline: none;
    border-color: #4CAF50;
}

.player-input input.error {
    border-color: #e74c3c;
}

#username-error {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 0.1rem;
    min-height: 1.2rem;
}

/* Bits Selector */
.bits-selector {
    text-align: center;
    padding: 1rem;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 16px var(--shadow-color);
    margin: 2rem 0;
    margin-bottom: -1rem;
}

input[type="range"] {
    width: 100%;
    max-width: 400px;
    margin: 0.5rem 0;
    -webkit-appearance: none;
    height: 10px;
    background: var(--slider-bg);
    border-radius: 5px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #45a049;
    transform: scale(1.1);
}

.bits-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.main-bits {
    font-size: 2rem;
    font-weight: bold;
    color: #4CAF50;
    text-shadow: 0 1px 2px var(--shadow-color);
}

.bonus-display {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(76, 175, 80, 0.2);
    font-size: 1.1rem;
    color: var(--text-color);
}

.bonus-label {
    color: #4CAF50;
}

.bonus-amount {
    font-weight: bold;
}

.bonus-bits {
    margin-left: 0.2rem;
}

.bonus-percentage {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-left: 0.3rem;
}

.price-display {
    font-size: 1.5rem;
    color: var(--text-color);
    font-weight: bold;
    margin-bottom: 0.2rem;
}

/* Terms Section */
.terms-section {
    margin: 2rem 0;
    padding: 1rem;
    text-align: center;
}

.terms-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: -1rem;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.terms-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.terms-checkbox span {
    color: var(--text-color);
    font-size: 0.95rem;
}

.terms-checkbox a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: bold;
}

.terms-checkbox a:hover {
    text-decoration: underline;
}

#terms-error {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    min-height: 1.2rem;
}

.support-info {
    margin-top: 0.5rem;
    margin-bottom: -0.5rem;
    padding: 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    text-align: center;
    font-size: 0.95rem;
}

.support-info a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    margin: 0 0.3rem;
}

.support-info a:hover {
    color: #45a049;
    text-decoration: underline;
}

.email-container {
    position: relative;
    display: inline-block;
}

.copy-email {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    margin: 0 0.3rem;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
}

.copy-email:hover {
    color: #45a049;
    text-decoration: underline;
}

.copy-email.copied {
    color: #45a049;
}

.copy-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.email-container:hover .copy-tooltip {
    opacity: 1;
}

/* Payment Section */
.payment-section {
    padding: 1rem 1rem;
    text-align: center;
    margin-top: -2rem;
    margin-bottom: -2.5rem;
}

.payment-section h3 {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

#paypal-button-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.paypal-buttons[disabled] {
    opacity: 0.5;
    pointer-events: none;
}

/* Sidebar and Goals */
.sidebar,
.goals-sidebar {
    flex: 1;
    max-width: 300px;
}

.module {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 16px var(--shadow-color);
}

.module h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.server-goals {
    text-align: left;
}

.goal-item {
    background: var(--card-bg);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid var(--input-border);
}

.goal-name {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.goal-description {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.goal-progress-bar {
    width: 100%;
    height: 10px;
    background: var(--progress-bg);
    border-radius: 5px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.goal-progress-fill {
    height: 100%;
    background: var(--progress-fill);
    transition: width 0.3s ease;
}

.goal-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-color);
}

.goal-amount {
    font-weight: bold;
}

/* Player Lists (Top Supporters & Recent Purchases) */
.module ul {
    display: grid;
    grid-template-columns: repeat(5, 40px);
    gap: 0.75rem;
    justify-content: center;
    margin: 1rem auto;
    max-width: 280px;
}

.module li {
    position: relative;
    display: inline-block;
    color: var(--text-color);
    width: 40px;
    height: 40px;
}

.module img {
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: transform 0.2s;
    image-rendering: pixelated;
    border-radius: 4px;
}

.module img:hover {
    transform: scale(1.1);
}

.module li .tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 1;
    background-color: var(--card-bg);
    color: var(--text-color);
    text-align: center;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    box-shadow: 0 4px 12px var(--shadow-color);
    width: max-content;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    margin-bottom: 0.5rem;
    transition: all 0.2s ease-in-out;
    font-size: 0.9rem;
    line-height: 1.4;
}

.module li:hover .tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.module li .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--card-bg) transparent transparent transparent;
}

/* Footer and Theme Switch */
footer {
    background-color: var(--card-bg);
    color: var(--text-color);
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: 0 -2px 4px var(--shadow-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.disclaimer {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.7;
    font-style: italic;
}

.theme-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.switch {
    position: relative;
    width: 48px;
    height: 24px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--card-bg);
    border-radius: 24px;
    border: 2px solid #4CAF50;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: #4CAF50;
    border-radius: 50%;
    transition: transform 0.3s;
}

.switch[aria-pressed="true"] .slider:before {
    transform: translateX(24px);
}

.theme-label {
    color: var(--text-color);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .store-container {
        grid-template-columns: 250px 1fr 250px;
        gap: 1.5rem;
        padding: 1.5rem;
    }
}

@media (max-width: 1000px) {
    .store-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .goals-sidebar,
    .sidebar {
        max-width: 100%;
    }

    .goal-item {
        max-width: 600px;
        margin: 0 auto 1rem auto;
    }
}

@media (max-width: 800px) {
    header {
        padding: 1rem;
    }

    .server-stats {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .stat-box {
        width: 100%;
        justify-content: center;
    }

    .logo img {
        height: 140px;
        margin: 1.5rem;
    }
    
    .store-container {
        padding: 0 1rem;
        margin: 1.5rem auto;
        gap: 1.5rem;
    }
    
    .store-content {
        padding: 1.5rem;
    }
    
    .bits-selector {
        padding: 1.5rem;
        margin: 1.5rem 0;
    }

    .payment-section {
        padding: 1.5rem 0;
        margin-top: 1.5rem;
    }

    .bits-display {
        font-size: 1.75rem;
    }

    .price-display {
        font-size: 1.25rem;
    }
}

@media (max-width: 600px) {
    footer {
        flex-direction: column;
        gap: 1rem;
    }

    .stat-box {
        font-size: 0.85rem;
        flex-wrap: wrap;
        padding: 0.75rem;
    }

    .copy-btn {
        width: 100%;
        margin-top: 0.5rem;
        margin-left: 0;
        font-size: 0.8rem;
        padding: 0.4rem;
    }

    .copy-btn .tooltip {
        display: none;
    }

    .logo img {
        height: 120px;
        margin: 1rem;
    }
}

@media (max-width: 400px) {
    .server-stats {
        gap: 0.75rem;
    }

    .stat-box {
        padding: 0.5rem;
    }

    .module ul {
        grid-template-columns: repeat(4, 40px);
        max-width: 220px;
    }
}
