/* Base Styles */
:root {
    --background-color: #12001e;
    --card-background: #240039;
    --text-color: #e0e0e0;
    --accent-color: #9400d3;
    --accent-hover: #ab47bc;
    --secondary-color: #6a0dad;
    --border-color: #400060;
    --modal-bg: #1a002a;
    --error-color: #ff3366;
    --success-color: #00e676;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: transparent; /* Fallback color */
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* background-image: url('/static/svg/6.png');  Replace with your image path */
    /* background-size: cover; /* Cover the entire viewport */
    /* background-position: center; /* Center the image */
    /* background-repeat: no-repeat; /* Do not repeat the image */
    /* background-attachment: fixed; /* Keep the background fixed during scroll */
    margin: 0;
    padding: 0;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

#app {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: transparent;
    position: relative;
    z-index: 1;
}

/* Header Styles */
header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(45deg, var(--accent-color), var(--accent-hover), #c47add);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#user-info {
    font-size: 14px;
    color: var(--secondary-color);
}

/* Main Content Styles */
main {
    flex: 1;
    padding-top: 16px;
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 76px; /* Adjusted for fixed button */
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.error-message {
    background-color: rgba(255, 82, 82, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 16px;
}

/* Offers Container */
.offers-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.offer-card {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.offer-card:hover, .offer-card:focus {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.offer-emoji {
    font-size: 32px;
    display: block;
}

.offer-title {
    font-size: 16px;
    font-weight: 600;
}

.offer-description {
    font-size: 12px;
    color: var(--secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Premium Button */
.premium-button {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 1;
}

.premium-button button {
    width: 100%;
    padding: 12px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.premium-button button:hover, .premium-button button:focus {
    background-color: var(--accent-hover);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background-color: var(--modal-bg);
    margin: 15% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s;
    overflow-y: auto;
    max-height: 85vh;
}

@keyframes modalFadeIn {
    from {opacity: 0; transform: translateY(20px);}
    to {opacity: 1; transform: translateY(0);}
}

.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(26, 0, 42, 0.5);
    min-height: 48px;
}

.modal-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header .offer-emoji {
    font-size: 24px;
    line-height: 1;
}

.modal-header h2 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1;
}

.close-button {
    color: var(--text-color);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.2);
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.close-button:hover {
    color: var(--accent-color);
    background-color: rgba(148, 0, 211, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 16px;
    background-color: var(--modal-bg);
}

.modal-body p {
    margin-bottom: 16px;
}

#offer-details {
    white-space: pre-line; /* Render newline characters */
}

.modal-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    background-color: var(--modal-bg);
    gap: 12px; /* Add gap between buttons */
}

.modal-footer button {
    padding: 12px 24px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-footer button:hover {
    background-color: var(--accent-hover);
}

/* Secondary button style for the open link button */
.modal-footer .button-secondary {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.modal-footer .button-secondary:hover {
    background-color: #6d6d6d;
}

/* Premium Modal Specific */
.premium-benefits {
    margin: 16px 0;
    list-style: none;
}

.premium-benefits li {
    margin-bottom: 8px;
}

.price-container {
    text-align: center;
    margin: 24px 0;
}

.price {
    display: inline-block;
    padding: 12px 24px;
    background-color: rgba(148, 0, 211, 0.1);
    border-radius: 16px;
}

.price .amount {
    font-size: 28px;
    font-weight: bold;
    color: var(--accent-color);
}

.price .period {
    font-size: 16px;
}

/* Loader */
.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--border-color);
    border-bottom-color: var(--accent-color);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    margin: 40px auto;
}

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

/* Responsive Adjustments */
@media (max-width: 480px) {
    .offers-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .offers-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 769px) {
    .offers-container {
        grid-template-columns: repeat(4, 1fr);
    }
    
    #app {
        max-width: 900px;
        margin: 0 auto;
    }
}

/* Countdown Timer Styles */
.countdown-container {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    background-color: rgba(130, 70, 175, 0.1);
    text-align: center;
}

.countdown-timer {
    font-size: 24px;
    font-weight: bold;
    margin: 10px 0;
    font-family: monospace;
}

#countdown-label {
    font-size: 14px;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

#countdown-message {
    font-size: 14px;
    color: var(--error-color);
    margin-top: 5px;
}

.offer-card.expired {
    opacity: 0.6;
    position: relative;
}

.offer-card.expired::after {
    content: attr(data-overlay-text);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    background-color: var(--error-color);
    color: white;
    padding: 5px 10px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 4px;
    z-index: 10;
}

/* Disabled button */
button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--secondary-color);
}

/* Styles for dynamically added modal content */
.modal-input {
    -webkit-appearance: none; /* Reset iOS default styling */
    appearance: none; /* Reset default browser styling */
    width: calc(100% - 20px);
    padding: 10px;
    margin: 10px 0;
    border: 1px solid var(--border-color, #400060);
    border-style: solid; /* Explicitly set border style */
    border-radius: 5px;
    background-color: var(--background-color, #12001e) !important;
    color: var(--text-color, #e0e0e0) !important;
    font-size: 16px;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent-color, #9400d3);
    box-shadow: 0 0 5px var(--accent-color, #9400d3);
}

.confirmation-text {
    padding: 8px 0;
    font-size: 0.95em;
    color: var(--success-color, #00e676);
    font-weight: 500;
    margin-top: 5px;
    margin-bottom: 10px;
    white-space: pre-line;
}

/* Styles for dynamically created Open Link button and instruction */
.open-link-instruction {
    font-size: 0.9em;
    color: var(--secondary-color, #6a0dad);
    margin-bottom: 8px;
    margin-top: 5px;
    white-space: pre-line;
}

.modal-step-instruction {
    margin-top: 10px;
    margin-bottom: 5px;
    font-size: 0.9em;
    white-space: pre-line;
    color: var(--text-color, #e0e0e0);
}

.modal-button.button-secondary {
    background-color: var(--accent-color, #9400d3);
    color: white;
    padding: 10px 15px;
    border: 1px solid var(--accent-color, #9400d3);
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    display: block;
    width: 100%;
    margin: 10px 0 15px 0;
    text-align: center;
}

.modal-button.button-secondary:hover {
    background-color: var(--accent-hover, #ab47bc);
    color: white;
    border-color: var(--accent-hover, #ab47bc);
}

/* Success Popup Styles */
.success-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.success-popup.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.success-popup-content {
    background-color: var(--card-background, #240039);
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.success-popup.show .success-popup-content {
    transform: scale(1);
}

.success-checkmark {
    font-size: 50px;
    color: var(--success-color, #00e676);
    display: block;
    margin-bottom: 15px;
}

#success-popup-message {
    font-size: 1.1em;
    color: var(--text-color, #e0e0e0);
    margin: 0;
}

/* Error Popup Styles - Using same structure as success popup */
.error-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.error-popup.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.error-popup-content {
    background-color: var(--card-background, #240039);
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.error-popup.show .error-popup-content {
    transform: scale(1);
}

.error-xmark {
    font-size: 50px;
    color: var(--error-color, #ff3366);
    display: block;
    margin-bottom: 15px;
}

#error-popup-message {
    font-size: 1.1em;
    color: var(--text-color, #e0e0e0);
    margin: 0;
}

/* Space Background Styles */
#space-background {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.card-container { 
    z-index: -1;
    pointer-events: none;
}

/* Styling for premium-locked offers */
.offer-card.premium-locked {
    opacity: 0.6;
    position: relative;
}

.offer-card.premium-locked::after {
    content: attr(data-overlay-text);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    background-color: var(--error-color);
    color: white;
    padding: 5px 10px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 4px;
    z-index: 10;
    text-align: center;
}

.method-container {
    margin: 20px 0;
    padding: 15px;
    background-color: var(--card-background);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.method-container pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    line-height: 1.5;
    color: var(--text-color);
}

/* Loading Animation Styles */
.loading-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.loading-animation.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.loading-animation-content {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-message {
    font-size: 1.2em;
    color: var(--text-color);
    margin: 0;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Success state for loading animation */
.loading-animation.success .loading-spinner {
    animation: none;
    border-color: var(--success-color);
    position: relative;
}

.loading-animation.success .loading-spinner::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 30px;
    color: var(--success-color);
    animation: checkmarkPop 0.5s ease-out;
}

@keyframes checkmarkPop {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.loading-animation.success .loading-message {
    color: var(--success-color);
    animation: none;
    font-weight: 600;
}

/* Slideshow Modal Styles */
.slideshow-content {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
}

.slideshow-container {
    position: relative;
    width: 100%;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--modal-bg);
    border-radius: 8px;
    overflow: hidden;
}

#slideshow-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.slideshow-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 50%;
    font-size: 18px;
    opacity: 0.7;
    transition: opacity 0.3s;
    z-index: 2;
}

.slideshow-nav:hover {
    opacity: 1;
    background: var(--accent-hover);
}

#prev-slide {
    left: 10px;
}

#next-slide {
    right: 10px;
}

.slideshow-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: background-color 0.3s;
}

.dot.active {
    background: var(--accent-color);
}

.tutorial-button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.3s;
    font-size: 14px;
    font-weight: 500;
}

.tutorial-button:hover {
    background: var(--accent-hover);
}

/* Loading spinner for buttons */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

/* Loading Animation Overlay */
.loading-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Wave container styles */
#wave-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-color: var(--background-color);
}

/* Content container to ensure content is above the wave background */
header, main, #auth-error, .modal {
    z-index: 1;
} 