/* ======================================================
   SLICK & MODERN UI OVERHAUL
   ====================================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes backgroundShine {
    from { background-position: 200% center; }
    to { background-position: -200% center; }
}

@keyframes aurora {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

:root {
    /* CORE PALETTE */
    --bg-main: #0F0520;
    --grad-1: #B47CFD;
    --grad-2: #FF7FC2;
    --text-light: #E9E4F0;
    --text-dark: #A8A2B3;
    --text-white: #FFFFFF;
    
    /* UI ELEMENTS */
    --card-bg: rgba(26, 15, 48, 0.6);
    --card-border: rgba(180, 124, 253, 0.2);
    --card-hover-border: rgba(180, 124, 253, 0.5);
    --input-bg: rgba(15, 5, 32, 0.7);
    --input-border: #3a2d51;

    /* ACCENTS */
    --star-filled: #FFD700;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --glow-color: rgba(180, 124, 253, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-light);
    min-height: 100vh;
    margin: 0;
    overflow-y: auto; /* Hide scrollbars from aurora effect */
    position: relative;
    display: flex; /* Add this */
    align-items: center; /* Add this */
    justify-content: center; /* Add this */
}

/* Animated Aurora Background Effect */
body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(125deg, 
        rgba(180, 124, 253, 0.15), 
        rgba(255, 127, 194, 0.15), 
        rgba(180, 124, 253, 0.15)
    );
    background-size: 400% 400%;
    animation: aurora 15s ease infinite;
    z-index: -1;
    filter: blur(100px);
}
/* --- Subscription Expired Overlay Styles --- */
.expired-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 5, 32, 0.95); /* Matches --bg-main with high opacity */
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.expired-content {
    max-width: 500px;
}

.expired-content .fa-exclamation-triangle {
    font-size: 3rem;
    color: #fde047; /* A warning yellow */
    margin-bottom: 1.5rem;
}

.expired-content h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 1.5rem;
}

.expired-stats {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-around;
}

.expired-stats p {
    font-size: 1rem;
    color: var(--text-dark);
}
/* ======================================================
   MOBILE OPTIMIZATIONS
   ====================================================== */
@media (max-width: 768px) {
    /* --- PERFORMANCE FIXES --- */
    /* Disable heavy effects on mobile for smoother performance */
    body::before {
        display: none;
    }
    .main-container, .login-container {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(26, 15, 48, 0.9);
    }

    /* --- DASHBOARD LAYOUT OPTIMIZATIONS --- */
    /* Reduce overall padding to give content more space */
    .main-container {
        padding: 1.25rem;
    }

    /* Stack the header content vertically */
    .main-container .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    /* Adjust the ad carousel for smaller screens */
    #ad-carousel-container {
        aspect-ratio: 16 / 9;
        max-height: 200px;
    }

    /* --- TYPOGRAPHY & READABILITY --- */
    /* Reduce the main header font size */
    .main-container .header h2 {
        font-size: 1.75rem;
    }

    /* Reduce the large stat numbers font size */
    .stat-card p {
        font-size: 2.25rem;
    }

    /* --- COMPONENT ADJUSTMENTS --- */
    /* Make review cards more compact */
    .review-card {
        padding: 1rem;
    }

    /* Make the tab buttons easier to click and evenly spaced */
    .tab-btn {
        padding: 0.75rem 1rem;
        flex-grow: 1; /* Make tabs share space evenly */
        text-align: center;
    }
}
.expired-stats p strong {
    display: block;
    color: var(--text-light);
    font-size: 1.25rem;
    margin-top: 0.5rem;
}

.expired-contact {
    color: var(--text-dark);
}

.expired-contact a {
    color: var(--grad-1);
    text-decoration: none;
    font-weight: 600;
}
.expired-contact a:hover {
    text-decoration: underline;
}
/* Main container for all pages */
.main-container {
    width: 100vw;
    min-height: 100vh; /* Use min-height to allow content to expand */
    height: auto;      /* Let height grow beyond the viewport */
    padding: 2.5rem;
    border-radius: 0;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    box-shadow: 0 16px 48px 0 var(--shadow-color);
    animation: fadeInUp 0.8s ease-out forwards;
    transition: border-color 0.3s ease;
}

.login-container {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: 0 16px 48px 0 var(--shadow-color);
    width: 100%;
    max-width: 450px; /* Added max-width back just for the login container */
    animation: fadeInUp 0.8s ease-out forwards;
    transition: border-color 0.3s ease;
}
/* --- Ad Carousel Sizing Fix --- */
/* --- Ad Carousel Sizing Fix --- */
#ad-carousel-container {
    width: 100%;
    max-height: 250px;
    aspect-ratio: 21 / 9;
    border-radius: 1rem; /* Rounded corners to match other cards */
    border: 1px solid var(--card-border); /* Consistent border style */
    padding: 0.75rem; /* Adds space between the border and the image */
    background: var(--input-bg); /* Subtle background for the container */
    margin-bottom: 2.5rem; /* Consistent spacing with other elements */
}
/* --- Fix for Ad Image Cropping --- */
#ad-carousel-container .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* This is the key property */
    object-position: center; /* This ensures it's centered */
}
/* Ensure the swiper and its contents fill the container */
#ad-carousel-container .swiper,
#ad-carousel-container .swiper-slide,
#ad-carousel-container .swiper-slide a {
    width: 100%;
    height: 100%;
}
.main-container:hover, .login-container:hover {
    border-color: var(--card-hover-border);
}

/* Login Page Styles */
.login-container {
    max-width: 450px;
}

h2, h3, h4 {
    color: var(--text-white);
    font-weight: 700;
}

.login-container h2 {
    font-size: 2.25rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 2.5rem;
    background: linear-gradient(90deg, var(--grad-1), var(--grad-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 0.75rem;
    padding: 1rem;
    color: var(--text-light);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--grad-1);
    box-shadow: 0 0 0 4px rgba(180, 124, 253, 0.2), 0 0 25px var(--glow-color);
}

/* Gradient Button Style */
button[type="submit"], #logout-btn {
    width: 100%;
    color: var(--text-white);
    font-weight: 700;
    font-size: 1rem;
    padding: 1rem;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, var(--grad-1), var(--grad-2), var(--grad-1));
    background-size: 200% auto;
    transition: all 0.4s ease;
}

button[type="submit"]:hover, #logout-btn:hover {
    background-position: right center;
    box-shadow: 0 0 20px rgba(180, 124, 253, 0.5);
    transform: translateY(-3px);
}

button[type="submit"]:active, #logout-btn:active {
    transform: translateY(-1px);
}

.error {
    color: var(--error-color);
    text-align: center;
    margin-top: 1rem;
    min-height: 1.5rem;
}

/* Dashboard Page Styles */

.main-container .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}
.main-container .header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}
#user-email {
    color: var(--text-dark);
    font-size: 0.9rem;
}
#logout-btn {
    width: auto;
    padding: 0.7rem 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.stat-card {
    background: var(--input-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
    border: 1px solid var(--input-border);
    transition: all 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--grad-1);
    box-shadow: 0 8px 30px var(--glow-color);
}
.stat-card h4 {
    color: var(--text-dark);
    font-size: 1rem;
    margin: 0 0 0.5rem 0;
    font-weight: 500;
}
.stat-card p {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-white);
    margin: 0;
    line-height: 1;
}

.reviews-section h3 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--card-border);
}
#reviews-list {
    display: grid;
    gap: 1.5rem;
}
/* Styling for the new Load More button */
.load-more-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 20px;
  background-color: var(--input-bg);
  color: var(--text-light);
  border: 1px solid var(--input-border);
  border-radius: 1rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.load-more-btn:hover {
  background-color: #3a2d51;
  border-color: var(--grad-1);
}

.load-more-btn:disabled {
  background-color: #1a1a1a;
  color: #666;
  cursor: not-allowed;
}
.review-card {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 1.5rem;
    border-radius: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease-out forwards;
}
.review-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px var(--glow-color);
    border-color: var(--grad-2);
}
.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.review-date {
    font-size: 0.875rem;
    color: var(--text-dark);
}
.stars .star {
    font-size: 1.25rem;
    color: #4b3a69;
}
.stars .star.filled {
    color: var(--star-filled);
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}
.review-message {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    color: var(--text-light);
    font-weight: 400;
}
.review-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--input-border);
}
.initial-click {
    font-size: 0.8rem;
    color: var(--text-dark);
}
.review-author {
    font-style: italic;
    color: var(--text-dark);
}

/* Staggered animation for review cards */
.review-card:nth-child(1) { animation-delay: 0.1s; }
.review-card:nth-child(2) { animation-delay: 0.2s; }
.review-card:nth-child(3) { animation-delay: 0.3s; }
.review-card:nth-child(4) { animation-delay: 0.4s; }
.review-card:nth-child(5) { animation-delay: 0.5s; }
/* Dashboard Tabs */
.tabs-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}
.tab-btn {
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    color: var(--text-dark);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    position: relative;
    transition: color 0.3s ease;
}
.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--grad-1), var(--grad-2));
    transform: scaleX(0);
    transition: transform 0.3s ease-out;
}
.tab-btn.active {
    color: var(--text-white);
}
.tab-btn.active::after {
    transform: scaleX(1);
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Rating Distribution Chart */
#analytics-content h4 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}
.chart-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.chart-bar-group {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    gap: 1rem;
}
.chart-label {
    font-weight: 600;
    color: var(--text-dark);
}
.chart-bar-wrapper {
    background-color: var(--input-bg);
    border-radius: 99px;
    border: 1px solid var(--input-border);
}
#copy-review-link-btn {
    width: auto;
    padding: 0.7rem 1.5rem;
    background-color: var(--input-bg);
    color: var(--text-light);
    border: 1px solid var(--input-border);
    border-radius: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

#copy-review-link-btn:hover {
    background-color: #3a2d51;
    border-color: var(--grad-1);
}
.chart-bar {
    height: 24px;
    width: 0%; /* Initial width for animation */
    border-radius: 99px;
    background: linear-gradient(90deg, var(--grad-1), var(--grad-2));
    transition: width 0.8s ease-out;
    text-align: right;
    padding-right: 10px;
    color: white;
    font-size: 0.8rem;
    line-height: 24px;
    white-space: nowrap;
    box-sizing: border-box;
}
.chart-count {
    font-weight: 700;
    text-align: right;
}
/* ======================================================
   MOBILE OPTIMIZATIONS (ADD THIS ENTIRE BLOCK)
   ====================================================== */
@media (max-width: 768px) {
    .user-info {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.5rem; 
}

#user-email {
    width: 100%;
    text-align: left;
}

.user-info button {
    flex-grow: 1;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}
    
    /* --- PERFORMANCE FIXES --- */
    body::before {
        display: none;
    }
    .main-container, .login-container {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(26, 15, 48, 0.9);
    }

    /* --- DASHBOARD LAYOUT OPTIMIZATIONS --- */
    /* Reduce overall padding on the main container */
    .main-container {
        padding: 1.25rem;
    }

    /* Stack the header content vertically */
    .main-container .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    /* Reduce the main header font size */
    .main-container .header h2 {
        font-size: 1.75rem;
    }

    /* Reduce the huge stat numbers font size */
    .stat-card p {
        font-size: 2.25rem;
    }

    /* Make review cards a bit more compact */
    .review-card {
        padding: 1rem;
    }

    /* Make the tab buttons easier to click */
    .tab-btn {
        padding: 0.75rem 1rem;
        flex-grow: 1; /* Make tabs share space evenly */
        text-align: center;
    }
}