:root {
    /* Dark Mode (Default) */
    --primary: hsl(239, 84%, 67%);
    --secondary: hsl(243, 75%, 58%);
    --background: hsl(215, 39%, 11%);
    --surface: hsl(215, 28%, 17%);
    --on-surface: hsl(210, 14%, 82%);
    --on-surface-secondary: hsl(215, 14%, 65%);
    --success: hsl(159, 82%, 40%);
    --error: hsl(0, 84%, 60%);
    --border: hsl(215, 19%, 27%);
    --border-focus: var(--primary);
    --focus-ring-color: hsla(239, 84%, 67%, 0.4);
    --error-focus-ring-color: hsla(0, 84%, 60%, 0.4);
    --shadow-color-base: hsla(0, 0%, 0%, 0.1);
    --shadow-color-layer: hsla(0, 0%, 0%, 0.06);
    --shadow-highlight: hsla(239, 84%, 67%, 0.3);
    --border-radius-lg: 1rem;
    --border-radius-md: 0.75rem;
    --border-radius-sm: 0.5rem;
    --transition-speed: 0.25s;
    --transition-easing: ease-out;
    --transition-bezier-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
    --font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
        sans-serif;
    --font-size-base: 1rem;
    --font-size-sm: 0.9rem;
    --font-size-lg: 1.1rem;
    --button-padding: 0.8rem 1.5rem;
    --header-height: 5.65rem;
}

body.light-mode {
    /* --- Professionally Designed Light Mode Palette --- */
    --primary: hsl(242, 80%, 60%);
    --secondary: hsl(244, 65%, 52%);
    --background: hsl(220, 25%, 97%);
    --surface: hsl(0, 0%, 100%);
    --on-surface: hsl(216, 28%, 18%);
    --on-surface-secondary: hsl(218, 15%, 45%);
    --success: hsl(150, 60%, 40%);
    --error: hsl(0, 75%, 55%);
    --border: hsl(220, 20%, 90%);
    --border-focus: var(--primary);
    --focus-ring-color: hsla(242, 80%, 60%, 0.4);
    --shadow-color-base: hsla(220, 30%, 85%, 0.5);
    --shadow-color-layer: hsla(220, 30%, 85%, 0.3);
    --shadow-highlight: hsla(242, 80%, 60%, 0.3);
}

/* Base styles */

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

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    background: var(--background);
    color: var(--on-surface);
    font-family: var(--font-family);
    min-height: 100vh;
    transition: background-color var(--transition-speed) var(--transition-easing),
        color var(--transition-speed) var(--transition-easing);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

body.with-header {
    padding-top: var(--header-height);
}

#app {
    flex-grow: 1;
    flex-direction: column;
}

#app.upload-container {
    flex-grow: 0.8;
}

/* --- Page Container Layouts --- */

.pricing-container,
.contact-container {
    width: 90%;
    margin: 2rem auto;
}

.upload-container,
.login-container,
.register-container,
.reset-container {
    width: 90%;
    align-self: center;
    align-content: center;
}

.upload-container {
    max-width: 700px;
}

.login-container {
    max-width: 424px;
}

.register-container,
.reset-container {
    max-width: 555px;
}

.pricing-container,
.contact-container {
    max-width: 1100px;
}

.upload-section,
.modal-content,
.success-section,
.restore-draft-bar {
    position: relative;
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 6px -1px var(--shadow-color-base),
        0 2px 4px -2px var(--shadow-color-layer);
    padding: 2.5rem;
    transition: transform var(--transition-speed) var(--transition-easing),
        box-shadow var(--transition-speed) var(--transition-easing);
    border: 1px solid var(--border);
}

.logo-title,
.page-title {
    text-align: center;
    font-weight: 600;
    font-size: 2rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

/* Specific adjustment for the site logo in the header */
.header-logo .logo-title {
    font-size: 1.8rem;
    margin-bottom: 0;
}

.page-title {
    margin-bottom: 1.5rem;
}

.modal-content p {
    text-align: center;
}

.section-title {
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--on-surface);
}

.upload-section:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px var(--shadow-color-base),
        0 4px 6px -4px var(--shadow-color-layer);
}

/* Drop zone styles */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--border-radius-md);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    margin-bottom: 1.5rem;
    background-color: hsla(0, 0%, 0%, 0.02);
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: border-color var(--transition-speed) var(--transition-easing),
        background-color var(--transition-speed) var(--transition-easing),
        box-shadow var(--transition-speed) var(--transition-easing),
        padding var(--transition-speed) var(--transition-easing);
}

.drop-zone p {
    position: relative;
    z-index: 1;
    color: var(--on-surface-secondary);
    font-weight: 500;
    margin: 0.5rem 0;
    transition: opacity var(--transition-speed) var(--transition-easing),
        visibility 0s linear var(--transition-speed),
        height var(--transition-speed) var(--transition-easing);
}

.drop-zone>p,
.drop-zone>button:not(.remove-btn) {
    transition: opacity var(--transition-speed) var(--transition-easing),
        visibility 0s linear var(--transition-speed),
        height var(--transition-speed) var(--transition-easing),
        margin var(--transition-speed) var(--transition-easing),
        padding var(--transition-speed) var(--transition-easing);
}

.drop-zone p:first-of-type {
    font-size: var(--font-size-lg);
    color: var(--on-surface);
    margin-bottom: 0.8rem;
}

.drop-zone.has-file {
    border-color: var(--primary);
}

.drop-zone.has-file>p,
.drop-zone.has-file>button:not(.remove-btn) {
    visibility: hidden;
    opacity: 0;
    height: 0;
    margin: 0 !important;
    padding: 0 !important;
    border: 0;
    transition: opacity var(--transition-speed) var(--transition-easing) 0s,
        visibility 0s linear var(--transition-speed),
        height var(--transition-speed) var(--transition-easing) 0s,
        margin var(--transition-speed) var(--transition-easing) 0s,
        padding var(--transition-speed) var(--transition-easing) 0s;
}

#videoDropZone,
#thumbnailDropZone {
    padding: 2.5rem;
}

#thumbnailDropZone.has-file {
    padding: 0.5rem;
}

.thumbnail-preview {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: var(--border-radius-sm);
    display: none;
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity var(--transition-speed) var(--transition-easing);
}

#thumbnailDropZone.has-file .thumbnail-preview {
    display: block;
    opacity: 1;
}

.video-preview {
    width: 100%;
    text-align: center;
    padding: 1rem;
    display: block;
    position: relative;
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) var(--transition-easing),
        visibility 0s linear var(--transition-speed);
}

#videoDropZone.has-file .video-preview {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.1s;
}

.video-preview .file-info {
    color: var(--on-surface);
    font-size: var(--font-size-sm);
    word-break: break-all;
}

.drop-zone:hover:not(.has-file) {
    border-color: var(--primary);
    background-color: hsla(242, 80%, 60%, 0.07);
}

.drop-zone.active {
    border-color: var(--primary);
    border-style: solid;
    background-color: hsla(242, 80%, 60%, 0.1);
    box-shadow: 0 0 0 4px var(--focus-ring-color);
    animation: pulseBorder 1.5s infinite var(--transition-easing);
}

.drop-zone.error {
    border-color: var(--error);
    border-style: dashed;
    animation: shake 0.5s var(--transition-bezier-smooth);
}

.error-message {
    color: var(--error);
    font-size: var(--font-size-sm);
    margin-top: 0.5rem;
    font-weight: 500;
    display: block;
    position: relative;
    z-index: 1;
    height: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) var(--transition-easing),
        visibility 0s linear var(--transition-speed);
}

.drop-zone.error .error-message {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.1s;
}

/* --- Refactored Button System --- */

/* Base .btn class for all buttons and button-like links */
.btn {
    /* Structure & Layout */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    overflow: hidden;

    /* Sizing & Spacing */
    padding: var(--button-padding);
    margin-top: 1rem;
    gap: 0.5rem;

    /* Typography */
    font-weight: 500;
    font-size: 0.95rem;
    color: hsl(0, 0%, 100%);
    text-decoration: none;

    /* Appearance */
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    -webkit-tap-highlight-color: transparent;

    /* Transitions */
    transition: background-color var(--transition-speed) var(--transition-easing),
        border-color var(--transition-speed) var(--transition-easing),
        transform var(--transition-speed) var(--transition-easing),
        box-shadow var(--transition-speed) var(--transition-easing);
}

/* Primary Button Style */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: hsl(0, 0%, 100%);
    /* EXPLICITLY set text color here */
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--shadow-highlight);
}

.btn:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(-1px) scale(0.97);
    box-shadow: 0 2px 5px var(--shadow-highlight);
    background: var(--secondary);
}

/* States applicable to all buttons */
.btn:disabled,
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.remove-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: hsla(240, 20%, 15%, 0.8);
    color: hsl(0, 0%, 100%);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    transition: background-color var(--transition-speed) var(--transition-easing),
        transform var(--transition-speed) var(--transition-easing);
    padding: 0;
    margin: 0;
}

body.light-mode .remove-btn {
    background: hsla(0, 0%, 95%, 0.8);
    color: var(--on-surface);
}

.drop-zone.has-file .remove-btn {
    display: flex;
}

.remove-btn:hover {
    background: var(--error);
    color: hsl(0, 0%, 100%);
    transform: scale(1.1) rotate(90deg);
    box-shadow: none;
}

body.light-mode .remove-btn:hover {
    background: var(--error);
    color: hsl(0, 0%, 100%);
}

.remove-btn:active {
    transform: scale(1) rotate(90deg);
    background-color: hsl(5, 65%, 46%);
}

.remove-btn:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: hsla(215, 41%, 15%, 0.8);
    /* Use background color with opacity */
    backdrop-filter: blur(6px);
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s var(--transition-easing);
}

.modal.open {
    display: flex;
}

.modal-content {
    transform: translateY(20px) scale(0.97);
    opacity: 0;
    animation: modalContentSlide 0.35s var(--transition-bezier-smooth) forwards;
    width: 100%;
    max-width: 600px;
    margin: auto;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    padding-bottom: 1.5rem;
    box-shadow: 0 10px 15px -3px var(--shadow-color-base),
        0 4px 6px -4px var(--shadow-color-layer);
}

/* Closing animation for modal */
.modal.is-closing {
    animation: modalFadeOut 0.3s var(--transition-easing) forwards;
}

.modal.is-closing .modal-content {
    animation: modalContentSlideOut 0.35s var(--transition-bezier-smooth) forwards;
}

#videoPreviewModal .modal-content {
    max-width: 750px;
}

#platformModal .modal-content {
    max-width: 700px;
}

.modal h2 {
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--on-surface);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--on-surface-secondary);
    transition: all var(--transition-speed) var(--transition-easing);
    z-index: 10;
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.close-btn:hover {
    color: hsl(0, 0%, 100%);
    background-color: var(--error);
    transform: rotate(90deg) scale(1.1);
}

.close-btn:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

#videoPreviewContainer {
    width: 100%;
    background: hsl(0, 0%, 0%);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
    position: relative;
}

#videoPreviewContainer video {
    display: block;
    width: 100%;
    max-height: 60vh;
    border-radius: var(--border-radius-md);
}

#removePreviewVideoBtn {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: hsla(0, 0%, 0%, 0.6);
    border-color: hsla(0, 0%, 100%, 0.4);
}

.modal-actions {
    text-align: center;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-base);
    background: var(--surface);
    color: var(--on-surface);
    transition: border-color var(--transition-speed) var(--transition-easing),
        box-shadow var(--transition-speed) var(--transition-easing);
}

body.light-mode input[type="text"],
body.light-mode input[type="email"],
body.light-mode input[type="password"],
body.light-mode input[type="date"],
body.light-mode input[type="time"],
body.light-mode textarea,
body.light-mode select {
    background: var(--background);
    color-scheme: light;
}

.form-group-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1rem;
    align-items: start;
}

/* Optional: To ensure margins are perfect within the grid */
.form-group-grid .form-group {
    margin-bottom: 0;
}

.form-label-hint {
    font-size: 0.8rem;
    font-weight: 400;
    /* Lighter than the main label */
    color: var(--on-surface-secondary);
    margin-left: 0.75rem;

    /* Animation properties */
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

/* When the input it's related to has focus, make the hint visible */
input:focus+.form-label-hint,
input:focus~.form-label-hint,
/* General sibling combinator for flexibility */
.form-group:focus-within .form-label-hint {
    /* Most robust solution */
    opacity: 1;
}

/* --- Browser Autofill Style Override --- */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--on-surface) !important;
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important; /* Force the background color */
    transition: background-color 5000s ease-in-out 0s;
    font-family: var(--font-family); /* Ensure font consistency */
    font-size: var(--font-size-base); /* Ensure font size consistency */
}

body.light-mode input:-webkit-autofill,
body.light-mode input:-webkit-autofill:hover,
body.light-mode input:-webkit-autofill:focus,
body.light-mode input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--background) inset !important;
}

input::placeholder,
textarea::placeholder {
    color: var(--on-surface-secondary);
    opacity: 0.6;
    font-size: var(--font-size-sm);
}

input[type="datetime-local"] {
    min-height: calc(1.6em + 1.6rem + 2px);
    color-scheme: dark;
    /* Default to dark scheme for consistency */
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
    border-color: var(--border-focus);
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

/* --- DATETIME PICKER GRID STYLES --- */

.datetime-picker-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    /* Give more space to the date input */
    gap: 1rem;
}

/* Ensure the separate date/time inputs have consistent heights */
input[type="date"],
input[type="time"] {
    min-height: calc(1.6em + 1.6rem + 2px);
}

/* Apply the color-scheme hint for better theme matching */
input[type="date"],
input[type="time"] {
    color-scheme: dark;
}

body.light-mode input[type="date"],
body.light-mode input[type="time"] {
    color-scheme: light;
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid hsla(0, 0%, 100%, 0.2);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}

.input-spinner {
    position: absolute;
    right: 3rem; /* Position it to the left of the password toggle */
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
}

button.is-loading .loading-spinner {
    display: inline-block;
}

button.is-loading .button-text {
    opacity: 0.7;
    margin-left: -0.5rem;
}

/* Platform selection styles */
.platform-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.platform-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--border-radius-md);
    background-color: hsla(0, 0%, 100%, 0.03);
    cursor: pointer;
    transition: all var(--transition-speed) var(--transition-easing);
    text-align: center;
    margin-top: 0;
    gap: 1rem;
}

.platform-button:hover {
    border-color: var(--primary);
    background-color: hsla(242, 80%, 60%, 0.1);
    transform: translateY(-3px);
}

body.light-mode .platform-button:hover {
    border-color: var(--primary);
    background-color: hsla(242, 80%, 60%, 0.1);
}

.platform-button.selected {
    border-color: var(--success);
    background-color: hsla(150, 60%, 40%, 0.15);
    box-shadow: 0 0 0 2px var(--success);
}

.platform-button:focus-visible {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.platform-button img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
}

.platform-button span {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--on-surface);
}

.platform-button.selected span {
    color: var(--success);
    font-weight: 600;
}

/* Progress bar styles */
.progress-bar-container {
    width: 100%;
    height: 12px;
    background-color: var(--border);
    border-radius: 6px;
    margin-top: 1.5rem;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.progress-bar-container[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--success), hsl(159, 82%, 54%));
    border-radius: 6px;
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

body.light-mode .progress-bar {
    background: linear-gradient(90deg, var(--success), hsl(150, 60%, 55%));
}

/* Success screen styles */
.success-section {
    padding: 3rem 2.5rem;
    text-align: center;
    animation: fadeIn 0.5s var(--transition-easing);
}

.success-section h2 {
    color: var(--success);
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.success-section p {
    color: var(--on-surface-secondary);
    font-size: var(--font-size-lg);
    margin-bottom: 2rem;
}

/* --- BUTTON REFINEMENTS --- */

/* Destructive Button Style */
.btn-destructive {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--error);
}

.btn-destructive:hover:not(:disabled) {
    background: var(--error);
    border-color: var(--error);
    color: hsl(0, 0%, 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px hsla(0, 75%, 55%, 0.3);
}

body.light-mode .btn-destructive:hover:not(:disabled) {
    background: var(--error);
    border-color: var(--error);
    color: hsl(0, 0%, 100%);
}

/* Inline Form Validation Errors */
.inline-error {
    color: var(--error);
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.inline-error.visible {
    opacity: 1;
}

input.invalid,
textarea.invalid,
select.invalid {
    border-color: var(--error);
}

input.invalid:focus,
textarea.invalid:focus,
select.invalid:focus {
    border-color: var(--error);
    box-shadow: 0 0 0 3px var(--error-focus-ring-color);
}

/* --- LOGIN PAGE STYLES --- */

.separator {
    text-align: center;
    color: var(--on-surface-secondary);
    margin: 1.5rem 0;
    position: relative;
    font-weight: 500;
}

.separator::before,
.separator::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: var(--border);
}

.separator::before {
    left: 0;
}

.separator::after {
    right: 0;
}

/* Secondary Button Style */
.btn-secondary {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--on-surface);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--background);
    border-color: var(--border);
    box-shadow: none;
    transform: translateY(-2px);
}

.button-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

.form-footer-link {
    font-size: 0.8rem;
    color: var(--on-surface-secondary);
}

.form-footer-link.forgot {
    text-align: left;
}

.form-footer-link.register {
    text-align: center;
}

.form-footer-link a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.form-footer-link a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

/* --- REGISTER PAGE REFINEMENTS --- */

.back-button {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    background: none;
    border: none;
    color: var(--on-surface-secondary);
    text-decoration: none;
    font-size: 1.75rem;
    font-weight: 600;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 6px;
    transition: all 0.2s var(--transition-easing);
}

.back-button:hover {
    background-color: var(--primary);
    color: hsl(0, 0%, 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 10px var(--shadow-highlight);
}

.back-button:active {
    background-color: var(--primary);
    padding-bottom: 6px;
    transform: scale(0.95);
}

.back-button:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

/* --- CONTACT PAGE STYLES --- */

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 4rem;
    align-items: center;
    width: 100%;
    opacity: 0;
    /* For fade-in animation */
    animation: fadeIn 0.6s var(--transition-easing) 0.1s forwards;
}

.contact-info {
    padding-right: 2rem;
}

.contact-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: font-size 0.3s var(--transition-easing);
}

.contact-description {
    font-size: var(--font-size-lg);
    color: var(--on-surface-secondary);
    line-height: 1.7;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: "▾";
    font-size: 1.5rem;
    color: var(--on-surface-secondary);
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

select option {
    background: var(--surface);
    color: var(--on-surface);
}

select:invalid {
    color: var(--on-surface-secondary);
}

.word-counter {
    text-align: right;
    font-size: 0.8rem;
    color: var(--on-surface-secondary);
    margin-top: 0.5rem;
    transition: color 0.2s ease-in-out;
}

.word-counter.error {
    color: var(--error);
    font-weight: 500;
}

.password-hint {
    font-size: 0.8rem;
    color: var(--on-surface-secondary);
    padding-left: 0.2rem;
    /* Animation properties */
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    overflow: hidden;
    transition: all 0.3s var(--transition-easing);
}

.password-hint.visible {
    max-height: 50px;
    /* A value larger than the expected height */
    opacity: 1;
    margin-top: 0.5rem;
}

/* --- LOGIN PAGE REFINEMENTS --- */

.login-subtitle {
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--on-surface-secondary);
}

.page-main-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 1rem;
    /* Space from logo */
    margin-bottom: 0.75rem;
}

.login-actions {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

.w-full {
    width: 100%;
}

.login-status {
    width: 100%;
    text-align: center;
    margin-top: 1rem;
    color: var(--on-surface-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    margin: 0;
    cursor: pointer;
    color: var(--on-surface-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.password-toggle:hover {
    color: var(--on-surface);
    background-color: var(--border);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* Ensure password inputs with a toggle icon have space for it */
.input-wrapper input {
    padding-right: 2.5rem;
}

/* Hide the browser's default password reveal icon (for Edge, IE) */
input[type="password"]::-ms-reveal {
    display: none;
    width: 0;
    height: 0;
}

/* --- FORGOT PASSWORD MODAL STYLES --- */
.text-center {
    text-align: center;
}

.modal-icon {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.modal-title-highlight {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--on-surface);
    margin-bottom: 1rem;
}

.modal-subtitle {
    font-size: 1.1rem;
    color: var(--on-surface);
    margin-bottom: 0.5rem;
}

.modal-prompt {
    color: var(--on-surface-secondary);
    margin-bottom: 2rem;
}

/* Adjustments for forgot password form */
#forgotPasswordForm .form-group {
    text-align: left;
    /* Align label/input left */
    margin-bottom: 1rem;
}

#emailSentModal .modal-subtitle strong {
    color: var(--on-surface);
    font-weight: 600;
}

/* --- Referral Section Styles --- */

.referral-apply-card,
.referral-share-card,
.referral-stats-card {
    margin-bottom: 1.5rem;
}

.referral-description {
    color: var(--on-surface-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
    font-size: var(--font-size-base);
}

.referral-input-group,
.referral-link-group {
    margin-bottom: 1rem;
}

.referral-code-input,
.referral-link-input {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.referral-status {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    display: none;
    transition: all var(--transition-speed) var(--transition-easing);
}

.referral-status.success {
    background-color: hsla(159, 82%, 40%, 0.1);
    color: var(--success);
    border: 1px solid hsla(159, 82%, 40%, 0.3);
    display: block;
}

.referral-status.error {
    background-color: hsla(0, 84%, 60%, 0.1);
    color: var(--error);
    border: 1px solid hsla(0, 84%, 60%, 0.3);
    display: block;
}

body.light-mode .referral-status.success {
    background-color: hsla(150, 60%, 40%, 0.1);
    color: hsl(150, 60%, 35%);
    border: 1px solid hsla(150, 60%, 40%, 0.3);
}

body.light-mode .referral-status.error {
    background-color: hsla(0, 75%, 55%, 0.1);
    color: hsl(0, 75%, 45%);
    border: 1px solid hsla(0, 75%, 55%, 0.3);
}

.referral-benefits {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background-color: hsla(0, 0%, 100%, 0.02);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border);
}

body.light-mode .referral-benefits {
    background-color: hsla(220, 25%, 95%, 0.5);
}

.benefit-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.benefit-item:last-child {
    margin-bottom: 0;
}

.benefit-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.benefit-text {
    color: var(--on-surface-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    text-align: center;
    padding: 1.25rem 1rem;
    background-color: hsla(0, 0%, 100%, 0.02);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border);
    transition: transform var(--transition-speed) var(--transition-easing);
}

.stat-item:hover {
    transform: translateY(-2px);
}

body.light-mode .stat-item {
    background-color: hsla(220, 25%, 95%, 0.5);
}

.stat-number {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--on-surface-secondary);
    font-weight: 500;
}

.applied-referral {
    padding: 1rem 1.25rem;
    background-color: hsla(242, 80%, 60%, 0.08);
    border: 1px solid hsla(242, 80%, 60%, 0.2);
    border-radius: var(--border-radius-sm);
}

body.light-mode .applied-referral {
    background-color: hsla(242, 80%, 60%, 0.05);
    border: 1px solid hsla(242, 80%, 60%, 0.15);
}

.applied-text {
    margin: 0;
    color: var(--on-surface);
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

.applied-text strong {
    color: var(--primary);
    font-weight: 600;
}

/* Button Loading and Success States */
.btn .btn-spinner {
    width: 16px;
    height: 16px;
    margin-left: 0.5rem;
}

.btn.loading .btn-text {
    opacity: 0.7;
}

.btn.loading .btn-spinner {
    display: inline-block;
}

.btn.success-state {
    background: var(--success);
    border-color: var(--success);
    transform: translateY(-1px);
}

.btn.error-state {
    background: var(--error);
    border-color: var(--error);
    transform: translateY(-1px);
}

/* Input States for Referral */
input[type="text"]:disabled {
    background-color: var(--border);
    color: var(--on-surface-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}

body.light-mode input[type="text"]:disabled {
    background-color: hsla(220, 20%, 90%, 0.5);
}

/* Responsive Design for Referral Section */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .benefit-item {
        flex-direction: column;
        text-align: center;
        padding: 0.75rem 0;
    }
    
    .benefit-icon {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .referral-benefits {
        padding: 1rem;
    }
    
    .stat-item {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .input-with-button {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .input-with-button input {
        margin-bottom: 0;
    }
    
    .input-with-button .btn {
        margin-top: 0;
        width: 100%;
    }
}

/* --- Header Styles --- */

.header-right-group {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-actions .btn {
    margin-top: 0;
}

.main-header,
.user-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid transparent;
    /* Default to a transparent border */
    align-items: center;
    z-index: 100;
    transition: background-color var(--transition-speed) var(--transition-easing),
        border-bottom-color var(--transition-speed) var(--transition-easing);
}

.main-header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 2rem 2.5rem;
}

.user-header {
    background-color: var(--background);
    padding: 1.5rem 2.5rem 1.5rem 2.5rem;
}

.main-header,
body.has-bordered-header .user-header {
    border-bottom-color: var(--border);
}

.header-nav {
    display: flex;
    font-size: 1.1rem;
    gap: 1.5rem;
}

.header-nav a {
    text-decoration: none;
    color: var(--on-surface-secondary);
    font-weight: 500;
    transition: color 0.2s ease-in-out;
}

.header-nav a.active-link {
    font-weight: 600;
    color: var(--primary);
}

.header-nav a:hover {
    color: var(--primary);
}

body.light-mode .header-nav a:hover {
    color: var(--primary);
}

body.light-mode .header-nav a.active-link {
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    flex-shrink: 0;
}

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    background-color: var(--border);
    color: var(--on-surface-secondary);
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out,
        border-color 0.2s ease-in-out;
}

.theme-toggle-btn:hover {
    border: 1px solid var(--focus-ring-color);
    background-color: var(--surface);
    color: var(--primary);
    transform: scale(1.05);
}

.theme-toggle-btn:active {
    background-color: var(--background);
    transform: scale(0.95);
}

.page-fade-in {
    animation: fadeIn 0.5s var(--transition-easing);
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--surface);
    color: var(--on-surface);
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}


/* --- Animation keyframes --- */
@keyframes fadeIn {
    from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}

    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseBorder {
    0% {
        box-shadow: 0 0 0 0 var(--focus-ring-color);
    }

    70% {
        box-shadow: 0 0 0 8px hsla(242, 80%, 60%, 0);
    }

    100% {
        box-shadow: 0 0 0 0 hsla(242, 80%, 60%, 0);
    }
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    10%,
    90% {
        transform: translateX(-4px);
    }

    30%,
    70% {
        transform: translateX(4px);
    }

    50% {
        transform: translateX(-2px);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes modalContentSlideOut {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    to {
        transform: translateY(20px) scale(0.97);
        opacity: 0;
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalContentSlide {
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes spin {
    from {
        transform: translateY(-50%) rotate(0deg);
    }
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* --- PRICING PAGE STYLES --- */

.pricing-header {
    text-align: center;
    margin-bottom: 4rem;
}

.pricing-subtitle {
    max-width: 555px;
    margin-left: auto;
    margin-right: auto;
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--on-surface-secondary);
}

.pricing-subtitle.above-toggle {
    margin-top: 3rem;
}

.logo-title.pricing {
    font-size: 3rem;
    font-weight: 700;
    /* Use standard bold weight */
}

.pricing-toggle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    font-weight: 500;
    color: var(--on-surface-secondary);
}

.toggle-label {
    transition: color var(--transition-speed) var(--transition-easing),
        font-weight var(--transition-speed) var(--transition-easing);
    cursor: pointer;
    user-select: none;
    /* Prevents text selection on click */
}

.toggle-label.active {
    color: var(--primary);
    font-weight: 600;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    border: 1px solid var(--border);
    transition: 0.4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: hsl(0, 0%, 100%);
    transition: 0.4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

body.dark-mode .slider {
    background-color: var(--surface);
}

body.dark-mode .slider:before {
    background-color: var(--on-surface-secondary);
}

body.dark-mode input:checked+.slider:before {
    background-color: hsl(0, 0%, 100%);
}

.save-badge {
    background-color: hsla(150, 60%, 40%, 0.15);
    color: var(--success);
    padding: 0.25rem 0.6rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    transition: opacity 0.3s var(--transition-easing);
}

.free-tier-banner {
    margin-top: 3rem;
    /* Adds consistent spacing above the banner */
}

.free-tier-banner .pricing-tier {
    max-width: 383px;
    /* Constrains width for a cleaner look on large screens */
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--primary);
    /* Permanent purple border */
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    align-items: stretch;
    /* Make cards same height */
    justify-items: center;
    /* Center cards horizontally */
}

.pricing-tier {
    max-width: 383px;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed) var(--transition-easing),
        box-shadow var(--transition-speed) var(--transition-easing);
    padding: 2rem;
}

/* Apply hover effect only to tiers inside the main grid, excluding the free tier */
.pricing-grid .pricing-tier:not(.recommended):hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px var(--shadow-color-base),
        0 4px 6px -4px var(--shadow-color-layer);
}

/* Push button to the bottom of the card */
.pricing-tier .modal-actions {
    margin-top: auto;
}

.tier-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.tier-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tier-description {
    font-size: var(--font-size-sm);
    color: var(--on-surface-secondary);
    min-height: 40px;
    /* Reserve space to prevent layout shifts */
}

.tier-price {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.price-amount {
    font-size: 3rem;
    font-weight: 700;
    color: var(--on-surface);
    transition: transform var(--transition-speed) var(--transition-easing),
        border-color var(--transition-speed) var(--transition-easing);
}

.price-amount.custom-price {
    font-size: 2.5rem;
    /* Make "Custom" text slightly smaller */
}

.price-period {
    font-size: var(--font-size-sm);
    color: var(--on-surface-secondary);
    margin-left: 0.25rem;
}

.features-list {
    list-style: none;
    padding: 0;
    margin-bottom: 2rem;
    flex-grow: 1;
    /* Allows the button to be pushed to the bottom */
}

.features-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: var(--font-size-sm);
}

.feature-tick {
    color: var(--success);
    font-weight: 700;
    font-size: 1.2rem;
}

.pricing-tier.recommended {
    border-color: var(--primary);
    transform: translateY(-10px);
    /* Lift the recommended card */
    box-shadow: 0 10px 15px -3px var(--shadow-color-base),
        0 4px 6px -4px var(--shadow-color-layer), 0 0 0 2px var(--primary);
    position: relative;
    overflow: hidden;
}

.pricing-tier.recommended:hover {
    transform: translateY(-15px);
    box-shadow: 0 20px 25px -5px var(--shadow-color-base),
        0 8px 10px -6px var(--shadow-color-layer), 0 0 0 2px var(--primary),
        0 0 40px 0 var(--shadow-highlight);
}

.tier-badge {
    position: absolute;
    top: 1.5rem;
    right: -45px;
    background: var(--primary);
    color: hsl(0, 0%, 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 2rem 0.5rem 3rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transform: rotate(45deg);
    box-shadow: 0 2px 4px hsla(0, 0%, 0%, 0.2);
}

.faq-section {
    margin-top: 5rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.faq-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2.5rem;
}

.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: border-color var(--transition-speed) var(--transition-easing);
    cursor: pointer;
    overflow: hidden;
    /* Important for the accordion effect */
}

.faq-item:hover {
    border-color: var(--primary);
}

.faq-item:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-question h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0;
}

.faq-toggle-icon {
    width: 1em;
    height: 1em;
    border-style: solid;
    border-width: 0.15em 0.15em 0 0;
    border-color: var(--on-surface-secondary);
    display: inline-block;
    transform: rotate(135deg);
    transition: transform var(--transition-speed) var(--transition-bezier-smooth);
}

.faq-item.open .faq-toggle-icon {
    transform: rotate(-45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s var(--transition-easing),
        padding-top 0.3s var(--transition-easing);
}

.faq-answer p {
    color: var(--on-surface-secondary);
    line-height: 1.7;
}

.faq-item.open .faq-answer {
    max-height: 200px;
    /* Adjust if answers are longer */
    padding-top: 1rem;
}

/* Style for the admin-specific link in the header */
.admin-link {
    background-color: hsla(242, 80%, 60%, 0.1);
    color: var(--primary) !important;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600 !important;
}

.admin-link:hover {
    background-color: hsla(242, 80%, 60%, 0.2);
}

/* --- DASHBOARD STYLES --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.placeholder-text {
    color: var(--on-surface-secondary);
    margin-top: 1rem;
    font-size: var(--font-size-sm);
}

.hero-visual {
    width: 100%;
    max-width: 800px;
    margin-top: 4rem;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 15px -3px var(--shadow-color-base),
        0 4px 6px -4px var(--shadow-color-layer);
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--on-surface-secondary);
    max-width: 600px;
    margin: -1rem auto 3rem;
    line-height: 1.7;
}

.features-section,
.why-us-section,
.final-cta-section {
    padding: 5rem 0;
    text-align: center;
}

.features-grid,
.value-prop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1100px;
    margin: 3rem auto 0;
    text-align: left;
}

.feature-card,
.value-prop-card {
    background-color: var(--surface);
    padding: 2.5rem 2rem;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border);
    transition: transform var(--transition-speed) var(--transition-easing),
        box-shadow var(--transition-speed) var(--transition-easing);
}

.feature-card:hover,
.value-prop-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px var(--shadow-color-base),
        0 4px 6px -4px var(--shadow-color-layer);
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1.5rem;
    background: var(--primary);
    padding: 8px;
    border-radius: var(--border-radius-sm);
    color: white;
    /* For SVGs that use currentColor */
}

.feature-card h3,
.value-prop-card h4 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--on-surface);
}

.feature-card p,
.value-prop-card p {
    color: var(--on-surface-secondary);
    line-height: 1.6;
}

.why-us-section {
    background-color: var(--surface);
    padding: 5rem 2rem;
    margin: 4rem 0;
    border-radius: var(--border-radius-lg);
}

.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--transition-easing),
        transform 0.6s var(--transition-easing);
}

.fade-in-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- HOME PAGE STYLES --- */
.home-container {
    width: 90%;
    max-width: 1250px;
    padding: 0 2rem;
    margin: 0 auto;
}

.hero-section {
    text-align: center;
    padding: 6rem 0;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--on-surface-secondary);
    max-width: 650px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* A larger button variant for primary CTAs */
.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.trusted-by-section {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 4rem;
}

.trusted-by-section p {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--on-surface-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.logos-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
    filter: grayscale(1) brightness(1.5);
}

body.light-mode .logos-container {
    filter: grayscale(1) opacity(0.6);
}

.logos-container img {
    height: 32px;
    max-width: 150px;
    object-fit: contain;
}

.final-cta-section .section-title {
    font-size: 2.5rem;
}

.final-cta-section p {
    color: var(--on-surface-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* --- FOOTER STYLES --- */
.main-footer-container {
    background-color: var(--surface);
    color: var(--on-surface-secondary);
    padding: 4rem 2rem 2rem;
    margin-top: 15px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-section h4 {
    font-size: 1.1rem;
    color: var(--on-surface);
    margin-bottom: 1.5rem;
}

.footer-section.about .logo-title {
    text-align: left;
    margin-bottom: 1.5rem;
}

.footer-section p {
    line-height: 1.7;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.75rem;
}

.footer-section ul a {
    color: var(--on-surface-secondary);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.footer-section ul a:hover {
    color: var(--primary);
}

.footer-section.subscribe form {
    display: flex;
    flex-direction: column;
}

.footer-section.subscribe input {
    margin-bottom: 1rem;
}

.footer-section.subscribe button {
    margin-top: 0;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    font-size: var(--font-size-sm);
}

/* --- SCHEDULER PAGE - TOP LEFT LOGO --- */

.scheduler-logo-container {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.page-context-btn {
    background-color: var(--surface);
    border: 1px solid var(--border);
    color: var(--on-surface-secondary);
    font-size: 1.3rem;
    font-weight: 549;
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius-sm);
    cursor: default;
    /* Make it look non-interactive */
    transition: background-color var(--transition-speed) var(--transition-easing),
        color var(--transition-speed) var(--transition-easing);
    /* ADD a transition */
}

.scheduler-logo-container .logo-title {
    font-size: 1.8rem;
    /* A bit smaller to feel less intrusive than a main header logo */
    margin: 0;
}

/* --- PROFILE DROPDOWN MENU STYLES --- */
.profile-menu-container {
    position: relative;
    /* Changed for dropdown positioning */
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--primary);
    color: hsl(0, 0%, 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.2s var(--transition-easing),
        box-shadow 0.2s var(--transition-easing);
}

.profile-icon-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px var(--shadow-highlight);
}

.profile-icon-btn:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.profile-picture {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.profile-initials {
    font-weight: 600;
    font-size: 1rem;
    color: hsl(0, 0%, 100%);
    display: flex;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    /* Position below the icon */
    right: 0;
    width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 20px -5px var(--shadow-color-base);
    padding: 0.5rem 0;

    /* Animation properties */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out, visibility 0s 0.2s;
}

.profile-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out, visibility 0s 0s;
}

.profile-dropdown ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.profile-dropdown a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--on-surface-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.profile-dropdown a:hover,
.profile-dropdown a:focus {
    background-color: var(--primary);
    color: hsl(0, 0%, 100%);
    outline: none;
}

.profile-dropdown hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.5rem 0;
}

.main-header .profile-menu-container {
    display: none;
    /* Hide profile menu by default on main header */
}

/* Add a class to show it when the user is logged in */
.main-header .profile-menu-container.visible {
    display: flex;
    /* Use flex to align items correctly */
    align-items: center;
    gap: 1.5rem;
}

/* --- USER PROFILE PAGE --- */

.profile-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: flex-start;
    padding-top: 1.25rem;
}

.profile-content {
    width: 90%;
    max-width: 818px;
    justify-self: center;
}

/* --- Profile Sidebar --- */
.profile-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 1.4rem);
    /* Sticks below the main header */
}

.profile-sidebar nav a {
    display: block;
    padding: 1rem 2.5rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    border-radius: var(--border-radius-sm);
    color: var(--on-surface-secondary);
    transition: background-color var(--transition-speed) var(--transition-easing),
        color var(--transition-speed) var(--transition-easing);
}

.profile-sidebar nav a:hover {
    background-color: var(--surface);
    color: var(--on-surface);
}

.profile-sidebar nav a.active {
    background-color: var(--primary);
    color: hsl(0, 0%, 100%);
    font-weight: 600;
}

/* --- Profile Content --- */
.profile-section {
    display: none;
    /* Hide all sections by default */
}

.profile-section.active {
    display: block;
    /* Show only the active section */
    animation: fadeIn 0.4s var(--transition-easing);
}

.content-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-md);
    padding: 2rem;
    margin-bottom: 2rem;
}

.content-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

/* Profile-specific form styles */
.profile-picture-group {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.profile-picture-actions .btn {
    margin-top: 0;
}

.input-with-button {
    display: grid;
    grid-template-columns: 1fr auto; 
    align-items: center;
    gap: 0; 
    transition: gap var(--transition-speed) var(--transition-easing); 
}

.input-with-button.visible {
    gap: 1rem;
}

.input-with-button .btn {
    margin-top: 0;
    white-space: nowrap; /* Prevent text from wrapping during animation */
    transition: all var(--transition-speed) var(--transition-easing);
    
    /* Initially hidden: no width, no padding, hidden overflow */
    max-width: 0;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    overflow: hidden;
}

/* State when the button should be visible */
.input-with-button.visible .btn {
    max-width: 200px; /* Animate to a max-width */
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    opacity: 1;
}

/* Two-Factor and Danger Zone Sections */
.two-factor-item,
.danger-zone-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.two-factor-item:not(:last-child),
.danger-zone-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.two-factor-description h3,
.danger-zone-description h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.two-factor-description p,
.danger-zone-description p {
    font-size: var(--font-size-sm);
    color: var(--on-surface-secondary);
}

.two-factor-item .btn,
.danger-zone-item .btn {
    margin-top: 0;
}

.two-factor-item .connect-btn {
    border-color: var(--success);
    color: var(--success);
}

.two-factor-item .connect-btn:hover {
    background-color: var(--success);
    color: hsl(0, 0%, 100%);
}

.danger-zone {
    border-color: var(--error);
}

.form-group {
    position: relative;    /* Needed for absolute positioning of the feedback element */
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 500;
    font-size: var(--font-size-sm);
    color: var(--on-surface-secondary);
}

.saved-feedback {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--success);
    font-size: var(--font-size-sm);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.saved-feedback.visible {
    opacity: 1;
}

/* Ensure the feedback doesn't overlap the input text */
.form-group input {
    padding-right: 4.5rem;
}

/* --- Fix for Centering 2FA Verification Input --- */
#verificationCodeInput {
    padding-left: 0;
    padding-right: 0;
}

/* --- Recovery Codes Modal Styles --- */
.recovery-codes-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Space between each recovery code row */
    margin-top: 2rem;
}

.recovery-code-item {
    display: grid;
    /* We use a grid to ensure perfect alignment of code and button */
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    background-color: var(--background);
}

.recovery-code-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-align: left;
}

.recovery-code-item .btn {
    margin-top: 0;
}

/* --- Helper Text Color Classes --- */
.modal-title.text-destructive {
    color: var(--error);
    font-weight: 700;
}

.consequence-list {
    padding-left: 2.5rem;
    color: var(--on-surface-secondary);
    line-height: 1.5;
}

.consequence-list li:not(:last-child) {
    margin-bottom: 0.5rem; /* Adds space between list items */
}

/* --- Profile Responsive --- */
@media (max-width: 900px) {
    .profile-container {
        grid-template-columns: 1fr;
        /* Stack sidebar and content */
    }

    .profile-sidebar {
        position: static;
        /* Let it scroll normally with content */
    }

    .profile-sidebar nav {
        display: flex;
        overflow-x: auto;
        /* Allow horizontal scrolling for nav links */
        -ms-overflow-style: none;
        /* IE and Edge */
        scrollbar-width: none;
        /* Firefox */
    }

    .profile-sidebar nav::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar for Chrome, Safari, Opera */
    }

    .profile-sidebar nav a {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* --- USER PROFILE PAGE - CONTENT SECTIONS --- */

.content-card-title.no-border {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Social Accounts Section */
.account-summary-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.account-summary-card .placeholder-text {
    margin-top: 0;
}

.account-meter {
    width: 200px;
    height: 8px;
    background-color: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.account-meter-bar {
    height: 100%;
    background-color: var(--primary);
    border-radius: 4px;
}

.social-platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.platform-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition-speed) var(--transition-easing);
}

.platform-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 4px 10px var(--shadow-color-base);
}

.platform-logo {
    width: 48px;
    height: 48px;
}

.platform-name {
    font-weight: 500;
    flex-grow: 1;
    /* Pushes button to the right */
}

.platform-card .btn {
    margin-top: 0;
}

.connect-btn {
    border-color: var(--success);
    color: var(--success);
    background: transparent;
}

.connect-btn:hover {
    background: var(--success) !important;
    color: hsl(0, 0%, 100%) !important;
}

.disconnect-btn {
    border-color: var(--error);
    color: var(--error);
    background: transparent;
}

.disconnect-btn:hover {
    background: var(--error) !important;
    color: hsl(0, 0%, 100%) !important;
}

/* Notification Section */
.notification-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
}

.notification-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.notification-description h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.notification-description p {
    font-size: var(--font-size-sm);
    color: var(--on-surface-secondary);
}

.notification-item .toggle-switch {
    flex-shrink: 0;
    margin-left: 1.5rem;
}

/* Subscription Section */
.subscription-card {
    border: 1px solid var(--border);
    border-radius: var(--border-radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.current-plan-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
}

.current-plan-price {
    font-weight: 500;
    margin: 0.5rem 0;
}

/* Referral Section */
#userReferralLink {
    cursor: text;
    background-color: var(--background);
}

@media (max-width: 600px) {

    .subscription-card,
    .account-summary-card {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .subscription-card .modal-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* --- GLOBAL RESPONSIVE STYLES --- */

/* For Large Desktops and 2K/4K screens */

@media (min-width: 1600px) {
    .contact-container {
        max-width: 1400px;
        /* Allow the contact grid to expand nicely */
    }

    .contact-grid {
        gap: 6rem;
        /* Increase the gap to use the new space */
    }

    .contact-title {
        font-size: 4rem;
        /* Make the title more impactful */
    }
}

/* For Tablets and smaller desktops */
@media (max-width: 1024px) {
    .contact-grid {
        gap: 2rem;
    }

    .contact-title {
        font-size: 2.75rem;
    }

    .contact-info {
        padding-right: 0;
    }

    /* New layout for pricing grid on tablets */
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pricing-tier.recommended,
    .pricing-tier.recommended:hover {
        order: 1;
        /* Pro comes first */
        grid-column: 1 / -1;
        /* Span both columns */
        transform: translateY(0);
        /* Reset lift for this layout */
    }

    .pricing-grid .pricing-tier:nth-child(1) {
        /* Starter */
        order: 2;
    }

    .pricing-grid .pricing-tier:nth-child(3) {
        /* Business */
        order: 3;
    }
}

/* For smaller tablets and large phones */
@media (max-width: 768px) {

    /* Reduce padding on primary content boxes for more space */
    .upload-section,
    .modal-content {
        padding: 2rem;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        /* Stack columns */
        gap: 3rem;
        text-align: center;
    }

    .contact-title {
        font-size: 2.5rem;
    }

    h1.logo-title {
        font-size: 1.8rem;
        /* Slightly smaller auth title on mobile */
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        /* Stack on mobile */
        gap: 2.5rem;
    }

    .scheduler-logo-container {
        gap: 1.5rem;
    }

    .pricing-header {
        margin-bottom: 3rem;
    }

    .pricing-tier.recommended {
        grid-column: auto;
        /* Reset column span for mobile stack */
    }

    .header-right-group {
        gap: 1rem;
    }

    .header-nav {
        display: none;
        /* Hiding nav links on mobile for simplicity, can be replaced with a hamburger menu later */
    }

    .home-container {
        padding: 0 1rem;
    }

    .hero-section {
        padding: 4rem 0;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .features-grid,
    .value-prop-grid {
        grid-template-columns: 1fr;
    }
}

/* For small mobile devices */
@media (max-width: 480px) {
    body.with-header {
        /* Adjust padding for a shorter mobile header */
        padding-top: 50px;
    }

    .main-header,
    .user-header {
        /* Reduce padding and height on mobile to save space */
        height: 70px;
        padding: 0.75rem 1rem;
    }

    /* --- Public Header Adjustments --- */
    .header-actions .btn-secondary .button-text {
        /* Hide text on the "Google" button */
        display: none;
    }

    .header-actions .btn-secondary .button-icon {
        /* Remove margin when text is hidden */
        margin-right: 0;
    }

    .header-actions {
        gap: 0.75rem;
        /* Reduce gap between buttons */
    }

    /* --- User Header Adjustments --- */
    .scheduler-logo-container {
        gap: 0.75rem;
        /* Reduce gap between logo and context button */
    }

    .page-context-btn {
        /* Make context button smaller */
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
    }

    /* Reduce padding on primary content boxes for more space */
    .upload-section,
    .modal-content {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        /* Stack First/Last name fields */
    }

    .btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
}
/* =====
 REFERRAL SECTION ENHANCEMENTS ===== */

/* Referral Section Specific Styles */
.referral-apply-card,
.referral-share-card,
.referral-stats-card {
    margin-bottom: 1.5rem;
}

.referral-description {
    color: var(--on-surface-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: var(--font-size-sm);
}

.referral-input-group,
.referral-link-group {
    margin-bottom: 1rem;
}

.referral-code-input,
.referral-link-input {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    letter-spacing: 0.5px;
    font-size: var(--font-size-sm);
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--on-surface);
}

.referral-code-input:focus,
.referral-link-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--focus-ring-color);
    outline: none;
}

/* Referral Status Display */
.referral-status {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    display: none;
    transition: all var(--transition-speed) var(--transition-easing);
}

.referral-status.success {
    background-color: hsla(159, 82%, 40%, 0.1);
    color: var(--success);
    border: 1px solid hsla(159, 82%, 40%, 0.3);
    display: block;
}

.referral-status.error {
    background-color: hsla(0, 84%, 60%, 0.1);
    color: var(--error);
    border: 1px solid hsla(0, 84%, 60%, 0.3);
    display: block;
}

.referral-status.info {
    background-color: hsla(239, 84%, 67%, 0.1);
    color: var(--primary);
    border: 1px solid hsla(239, 84%, 67%, 0.3);
    display: block;
}

/* Light mode adjustments for referral status */
body.light-mode .referral-status.success {
    background-color: hsla(150, 60%, 40%, 0.1);
    color: hsl(150, 60%, 35%);
    border-color: hsla(150, 60%, 40%, 0.3);
}

body.light-mode .referral-status.error {
    background-color: hsla(0, 75%, 55%, 0.1);
    color: hsl(0, 75%, 45%);
    border-color: hsla(0, 75%, 55%, 0.3);
}

body.light-mode .referral-status.info {
    background-color: hsla(242, 80%, 60%, 0.1);
    color: hsl(242, 80%, 50%);
    border-color: hsla(242, 80%, 60%, 0.3);
}

/* Enhanced referral input validation styles */
.referral-code-input.invalid {
    border-color: var(--error);
    box-shadow: 0 0 0 2px var(--error-focus-ring-color);
}

.referral-code-input.invalid:focus {
    border-color: var(--error);
    box-shadow: 0 0 0 3px var(--error-focus-ring-color);
}

/* Loading state improvements */
.btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn.loading .btn-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Success state for applied referral */
.referral-input-group.applied .referral-code-input {
    background-color: var(--success-bg, hsla(159, 82%, 40%, 0.1));
    border-color: var(--success, hsl(159, 82%, 40%));
    color: var(--success);
}

.referral-input-group.applied .btn {
    background-color: var(--success);
    border-color: var(--success);
    cursor: not-allowed;
}

/* Referral Benefits Section */
.referral-benefits {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background-color: var(--surface);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border);
    transition: all var(--transition-speed) var(--transition-easing);
}

.referral-benefits:hover {
    border-color: hsla(239, 84%, 67%, 0.3);
    box-shadow: 0 2px 8px var(--shadow-color-base);
}

.benefit-item {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.benefit-item:last-child {
    margin-bottom: 0;
}

.benefit-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.benefit-text {
    color: var(--on-surface-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

/* Referral Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    text-align: center;
    padding: 1.25rem 1rem;
    background-color: var(--background);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border);
    transition: all var(--transition-speed) var(--transition-easing);
}

.stat-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color-base);
}

.stat-number {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--on-surface-secondary);
    font-weight: 500;
}

/* Applied Referral Information */
.applied-referral {
    padding: 1rem 1.25rem;
    background-color: hsla(239, 84%, 67%, 0.1);
    border: 1px solid hsla(239, 84%, 67%, 0.3);
    border-radius: var(--border-radius-sm);
    margin-top: 1rem;
}

.applied-text {
    margin: 0;
    color: var(--primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

body.light-mode .applied-referral {
    background-color: hsla(242, 80%, 60%, 0.1);
    border-color: hsla(242, 80%, 60%, 0.3);
}

body.light-mode .applied-text {
    color: hsl(242, 80%, 50%);
}

/* Button Loading States */
.btn .btn-spinner {
    width: 16px;
    height: 16px;
    margin-left: 0.5rem;
    display: none;
}

.btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn.loading .btn-text {
    opacity: 0.7;
}

.btn.loading .btn-spinner {
    display: inline-block;
}

/* Copy Button Feedback */
.btn.copied {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: white !important;
    transform: scale(0.95);
}

.btn.copied .btn-text::after {
    content: ' ✓';
}

/* Screen Reader Only Content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Referral Input Enhancements */
.referral-code-input::placeholder,
.referral-link-input::placeholder {
    color: var(--on-surface-secondary);
    opacity: 0.7;
}

.referral-code-input:disabled,
.referral-link-input:disabled {
    background-color: var(--background);
    opacity: 0.6;
    cursor: not-allowed;
}

/* Enhanced Input with Button for Referral */
.referral-input-group .input-with-button,
.referral-link-group .input-with-button {
    position: relative;
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    transition: border-color var(--transition-speed) var(--transition-easing),
                box-shadow var(--transition-speed) var(--transition-easing);
}

/* Unified focus state for the entire input-button group */
.referral-input-group .input-with-button:focus-within,
.referral-link-group .input-with-button:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.referral-input-group .input-with-button input,
.referral-link-group .input-with-button input {
    flex: 1;
    border: none;
    border-top-left-radius: var(--border-radius-sm);
    border-bottom-left-radius: var(--border-radius-sm);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    background: transparent;
    outline: none;
    box-shadow: none;
    padding: 0.8rem 1rem;
}

.referral-input-group .input-with-button input:focus,
.referral-link-group .input-with-button input:focus {
    border: none;
    outline: none;
    box-shadow: none;
}

/* Remove number input arrows */
.referral-code-input::-webkit-outer-spin-button,
.referral-code-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.referral-code-input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.referral-input-group .input-with-button .btn,
.referral-link-group .input-with-button .btn {
    border: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: var(--border-radius-sm);
    border-bottom-right-radius: var(--border-radius-sm);
    white-space: nowrap;
    min-width: auto;
    margin: 0;
    /* Override the general input-with-button hiding rules */
    max-width: none !important;
    opacity: 1 !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    flex-shrink: 0;
}

/* Button Loading States for Referral */
.referral-input-group .btn.loading,
.referral-link-group .btn.loading {
    position: relative;
    pointer-events: none;
}

.referral-input-group .btn.loading .btn-text,
.referral-link-group .btn.loading .btn-text {
    opacity: 0.7;
}

.referral-input-group .btn .btn-spinner,
.referral-link-group .btn .btn-spinner {
    width: 16px;
    height: 16px;
    margin-left: 0.5rem;
    display: none;
}

.referral-input-group .btn.loading .btn-spinner,
.referral-link-group .btn.loading .btn-spinner {
    display: inline-block;
}

/* Button Feedback Animations */
.referral-input-group .btn.success,
.referral-link-group .btn.success {
    background-color: var(--success);
    border-color: var(--success);
    transform: scale(1.02);
}

.referral-input-group .btn.success .btn-text,
.referral-link-group .btn.success .btn-text {
    animation: successPulse 0.3s ease-out;
}

.referral-input-group .btn.copied,
.referral-link-group .btn.copied {
    background-color: var(--success);
    border-color: var(--success);
    color: white;
    animation: copySuccess 0.4s ease-out;
}

/* Copy Success Animation */
@keyframes copySuccess {
    0% {
        transform: scale(1);
        background-color: var(--primary);
    }
    50% {
        transform: scale(1.05);
        background-color: var(--success);
    }
    100% {
        transform: scale(1);
        background-color: var(--success);
    }
}

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

/* Responsive Design for Referral Section */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .benefit-item {
        flex-direction: column;
        text-align: center;
        padding: 0.75rem 0;
    }
    
    .benefit-icon {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .referral-benefits {
        padding: 1rem;
    }
    
    .stat-item {
        padding: 1rem 0.75rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .referral-input-group .input-with-button,
    .referral-link-group .input-with-button {
        flex-direction: column;
    }
    
    .referral-input-group .input-with-button input,
    .referral-link-group .input-with-button input {
        border-radius: var(--border-radius-sm);
        border-right: 1px solid var(--border);
        margin-bottom: 0.5rem;
    }
    
    .referral-input-group .input-with-button .btn,
    .referral-link-group .input-with-button .btn {
        border-radius: var(--border-radius-sm);
        width: 100%;
    }
}

@media (max-width: 480px) {
    .referral-apply-card,
    .referral-share-card,
    .referral-stats-card {
        margin-bottom: 1rem;
    }
    
    .referral-description {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }
    
    .benefit-text {
        font-size: 0.85rem;
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
}

/* Animation for referral status messages */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.referral-status.success,
.referral-status.error,
.referral-status.info {
    animation: slideInDown 0.3s var(--transition-easing);
}

/* Focus management for accessibility */
.referral-code-input:focus + .btn,
.referral-link-input:focus + .btn {
    border-color: var(--border-focus);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .referral-benefits {
        border-width: 2px;
    }
    
    .stat-item {
        border-width: 2px;
    }
    
    .referral-status.success,
    .referral-status.error,
    .referral-status.info {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .stat-item:hover {
        transform: none;
    }
    
    .referral-status.success,
    .referral-status.error,
    .referral-status.info {
        animation: none;
    }
    
    .btn.copied {
        transform: none;
    }
}/* Addi
tional Referral Section Enhancements */

/* Hover effects for referral cards */
.referral-apply-card:hover,
.referral-share-card:hover,
.referral-stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px var(--shadow-color-base),
        0 4px 10px -6px var(--shadow-color-layer);
    transition: transform var(--transition-speed) var(--transition-easing),
        box-shadow var(--transition-speed) var(--transition-easing);
}

/* Enhanced focus states for accessibility */
.referral-code-input:focus,
.referral-link-input:focus {
    transform: scale(1.01);
    transition: transform var(--transition-speed) var(--transition-easing);
}

/* Button hover enhancements for referral section */
.referral-input-group .btn:hover:not(:disabled):not(.loading),
.referral-link-group .btn:hover:not(:disabled):not(.loading) {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 12px var(--shadow-highlight);
}

/* Loading state improvements */
.referral-input-group .btn.loading:hover,
.referral-link-group .btn.loading:hover {
    transform: none;
    box-shadow: none;
}

/* Enhanced theme support for light mode */
body.light-mode .referral-benefits {
    background-color: hsla(220, 25%, 95%, 0.8);
    border-color: hsla(220, 20%, 85%, 0.8);
}

body.light-mode .referral-benefits:hover {
    border-color: hsla(242, 80%, 60%, 0.4);
    background-color: hsla(242, 80%, 60%, 0.05);
}

body.light-mode .stat-item {
    background-color: hsla(220, 25%, 95%, 0.8);
    border-color: hsla(220, 20%, 85%, 0.8);
}

/* Improved button feedback for light mode */
body.light-mode .referral-input-group .btn.copied,
body.light-mode .referral-link-group .btn.copied {
    background-color: var(--success);
    border-color: var(--success);
    color: white;
}

body.light-mode .referral-input-group .btn.success,
body.light-mode .referral-link-group .btn.success {
    background-color: var(--success);
    border-color: var(--success);
    color: white;
}

/* Screen reader only class for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Enhanced mobile responsiveness */
@media (max-width: 480px) {
    .referral-description {
        font-size: var(--font-size-sm);
        line-height: 1.4;
    }
    
    .benefit-text {
        font-size: 0.8rem;
    }
    
    .referral-input-group .btn,
    .referral-link-group .btn {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }
    
    .referral-status {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Improved animation performance */
.referral-input-group .btn,
.referral-link-group .btn,
.referral-apply-card,
.referral-share-card,
.referral-stats-card {
    will-change: transform;
}

/* Reset will-change after animations */
.referral-input-group .btn:not(:hover):not(.loading):not(.copied):not(.success),
.referral-link-group .btn:not(:hover):not(.loading):not(.copied):not(.success),
.referral-apply-card:not(:hover),
.referral-share-card:not(:hover),
.referral-stats-card:not(:hover) {
    will-change: auto;
}