/*
===============================================================================
PRO COACH STUDIO - STYLES - Typography & Color System Enhanced v8 - Aug 5, 2025
===============================================================================
*/

/* --- 1. Imports and Global Settings --- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
}

/* --- Brand Colors and Theme Variables --- */
:root {
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --bg-color: #151b26;           /* Softened from #0f172a - less harsh contrast */
    --bg-color-light: #1e293b;    /* Main content/sidebar background */
    --bg-color-lighter: #2a3441;  /* Form inputs and interactive elements */
    --bg-color-form: #243040;     /* Form container backgrounds for grouping */
    --text-color: #cbd5e1;
    --heading-color: #ffffff;
    --border-color: #374151;      /* Slightly softer border color */
    
    /* Additional variables for profile page */
    --card-bg: #1e293b;           /* Same as bg-color-light for consistency */
    --text-muted: #94a3b8;        /* Slightly muted text color */
    --input-bg: #2a3441;         /* Same as bg-color-lighter */
    --hover-bg: #334155;         /* Slightly lighter than input-bg */
    --accent-color: #ffc107;     /* Same as warning-color for consistency */
    
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --success-color: #22c55e;
    
    --gray-200: #e2e8f0;
    --gray-500: #64748b;
    --gray-600: #475569;
    
    --font-size-base: 0.875rem;
    --font-size-md: 1rem;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
}

/* --- Utility Classes --- */
.hidden {
    display: none !important;
}

.mobile-hidden {
    display: inline;
}

/* --- Base Styles --- */
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow-x: hidden;
    font-size: 1rem;
}

body, h1, h2, h3, h4, h5, h6, p, a, button, input, textarea, select, label, span, div {
    font-family: 'Roboto', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
    font-weight: var(--font-weight-semibold);
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

hr {
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
}

/* --- Button System --- */
.btn {
    padding: 0.7rem 1.4rem;
    border-radius: 6px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    
    background-color: var(--primary-color);
    color: white;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

/* Prevent hover effects during loading */
.btn.loading-glow:hover {
    transform: none !important;
    box-shadow: none !important;
    background-color: var(--primary-color) !important;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
}

.btn-secondary:hover {
    background-color: var(--bg-color);
    border-color: var(--text-color);
    transform: none;
    box-shadow: none;
}

.btn-demo {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0b5ed7 100%);
    border: 1px solid var(--primary-color);
    padding: 0.5rem 1rem;
    font-size: 13px;
    border-radius: 6px;
    font-weight: 600;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    box-shadow: 0 2px 4px var(--primary-200);
    transition: all 0.2s ease;
}

.btn-demo:hover {
    background: linear-gradient(135deg, #0b5ed7 0%, var(--primary-color) 100%);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
    color: white;
}

.btn[type="submit"],
.btn[hx-post] {
    padding: 0.7rem 1.4rem;
    font-weight: 600;
    margin: 0;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- Main Layout --- */
.main-container {
    max-width: 100vw;
    margin: 0;
    padding: 3rem 3rem 2rem 3rem;  /* Increased top padding from 2rem to 3rem for more breathing room */
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 3rem;
    min-height: 100vh;
    overflow-x: hidden;
    justify-items: center;
}

@media (min-width: 768px) {
    .main-container:has(.chat-active) {
        justify-items: stretch;
    }
}

.sidebar, .downloads {
    background-color: var(--bg-color-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
    justify-self: start;
    min-width: 0;
    overflow: hidden;
}

.main-content {
    background-color: var(--bg-color-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 1200px;
}

.main-content h1 {
    text-align: center;
    margin-bottom: 1.25rem;
    color: var(--primary-color);
}

.main-content > p {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* --- Sidebar Components --- */
.sidebar-title {
    color: var(--heading-color);
    margin-bottom: 1rem;
    text-align: center;
}

.sidebar-description {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    font-size: 14px;
    text-align: center;
}

.section-divider {
    border-top: 1px solid var(--border-color);
    margin: 2rem 0 1.5rem 0;
}

/* Override mobile-tools-grid for sidebar to be single column */
.sidebar .mobile-tools-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tool-button {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    margin-bottom: 0;
    background-color: var(--bg-color-lighter);  /* Using harmonized color */
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-sizing: border-box;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
}

.tool-button:hover,
.tool-button.active {
    background-color: var(--primary-color);
    color: white;
}

.download-item {
    margin-bottom: 1rem;
    padding: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color-lighter);  /* Using harmonized color */
    transition: all 0.2s ease;
    text-align: center;
}

.download-item:hover {
    border-color: var(--primary-color);
}

.download-item:last-child {
    margin-bottom: 0;
}

.download-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.3rem;
    gap: 0.5rem;
}

.download-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.download-title {
    color: var(--heading-color);
    font-size: 13px;
    font-weight: 600;
    margin: 0;
}

.download-description {
    color: var(--text-color);
    font-size: 11px;
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

.download-btn {
    width: auto;
    max-width: 150px;
    margin: 0 auto;
    font-size: 11px;
    padding: 0.35rem 0.6rem;
    display: block;
    text-align: center;
    border-radius: 6px;
    background-color: var(--gray-600);
    color: var(--gray-200);
    border: 1px solid var(--gray-500);
    transition: all 0.2s ease;
    text-decoration: none;
    min-height: auto;
    line-height: 1.2;
    word-wrap: break-word;
}

.download-btn:hover {
    background-color: var(--gray-500);
    color: white;
    border-color: var(--gray-400);
    transform: none;
    box-shadow: none;
}

.download-btn.locked {
    background-color: var(--gray-700);
    color: var(--gray-400);
    border-color: var(--gray-600);
    cursor: not-allowed;
    opacity: 0.8;
    position: relative;
}

.download-btn.locked:hover {
    background-color: var(--gray-700);
    color: var(--gray-400);
    border-color: var(--gray-600);
    cursor: not-allowed;
    transform: none;
}

.download-btn.locked::before {
    content: "🔒 ";
    margin-right: 0.25rem;
}

/* --- Mobile Tools Navigation --- */
.mobile-tools-nav {
    display: none;
    background-color: var(--bg-color-light);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
}

.mobile-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    max-width: 500px;
    margin: 0 auto;
}

.mobile-tool-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.5rem;
    background-color: var(--bg-color-lighter);  /* Using harmonized color */
    border: 1px solid var(--border-color);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
    min-height: 55px;
}

.mobile-tool-button:hover,
.mobile-tool-button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

.tool-icon {
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
    line-height: 1;
}

.tool-name {
    font-size: 13px;
    line-height: 1.1;
    font-weight: 600;
}

/* --- Form Styling --- */
.form-group {
    margin: 0 0 1rem 0;
    position: relative;
    z-index: 1;
}

/* Form container for better visual grouping */
.form-container {
    background-color: var(--bg-color-form);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group:last-of-type {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--heading-color);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-md);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background-color: var(--bg-color-lighter);  /* Using the new lighter tone */
    color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: var(--font-size-md);
    min-height: 3.25rem;
    line-height: 1.5;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.form-group:focus-within {
    z-index: 20;
}

.form-group select {
    padding: 0.875rem 3.5rem 0.875rem 1rem !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='white' d='M8 11.5l-4-4h8l-4 4z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    position: relative;
    z-index: 10;
}

/* Ensure select dropdown appears above other elements */
.form-group select:focus {
    z-index: 1000;
    position: relative;
}

/* Form rows with better responsive behavior */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    margin-bottom: 0;
    position: relative;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--warning-color);
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.25);
}

.form-group textarea {
    min-height: 6rem;
    resize: vertical;
    line-height: 1.6;
}

.form-row.two-col {
    grid-template-columns: 1fr 1fr;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group small {
    color: var(--text-color);
    font-size: 12px;
    opacity: 0.8;
    margin-top: 0.5rem;
    display: block;
    line-height: 1.4;
}

.button-container {
    margin-top: 1.5rem;
    text-align: left;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    min-height: 48px;
}

.button-container .btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button-container .loading-indicator {
    margin-left: 1rem;
}

/* --- Chat Tool Specific Styling --- */
.chat-tool-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

@media (min-width: 768px) {
    .chat-tool-container {
        max-width: 1000px;
    }
}

.chat-tool-container .form-group {
    text-align: left;
}

.chat-tool-container .form-group label {
    text-align: center;
    font-size: 16px;
    margin-bottom: 1rem;
}

.chat-interface {
    display: flex;
    flex-direction: column;
    min-height: 60vh;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 2rem;
    min-height: 50vh;
    max-width: 100%;
}

.chat-response:not(:empty) ~ .chat-messages {
    justify-content: flex-start;
    align-items: stretch;
}

.chat-response:not(:empty) ~ .chat-messages .welcome-message {
    display: none;
}

.chat-message {
    margin-bottom: 1.5rem;
    max-width: 100%;
}

.user-message {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 18px 18px 4px 18px;
    margin-left: auto;
    margin-right: 0;
    max-width: 80%;
    margin-bottom: 0.5rem;
}

.assistant-message {
    background-color: var(--bg-color-lighter);  /* Using harmonized color */
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 1rem;
    border-radius: 18px 18px 18px 4px;
    margin-left: 0;
    margin-right: auto;
    max-width: 95%;
    line-height: 1.6;
}

@media (min-width: 1024px) {
    .assistant-message {
        max-width: 100%;
    }
    .user-message {
        max-width: 85%;
    }
}

.assistant-message h1,
.assistant-message h2,
.assistant-message h3,
.assistant-message h4 {
    color: var(--heading-color);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.assistant-message h3 {
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3rem;
}

.assistant-message ul,
.assistant-message ol {
    margin: 0.8rem 0;
    padding-left: 1.5rem;
}

.assistant-message li {
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

.assistant-message p {
    margin: 0.8rem 0;
    line-height: 1.6;
}

.assistant-message p:first-child {
    margin-top: 0;
}

.assistant-message p:last-child {
    margin-bottom: 0;
}

.assistant-message p + ul,
.assistant-message p + ol {
    margin-top: 0.4rem;
}

.assistant-message ul + p,
.assistant-message ol + p {
    margin-top: 1rem;
}

.assistant-message br {
    line-height: 1.8;
}

.assistant-message strong {
    color: var(--heading-color);
    font-weight: 600;
}

.assistant-message em {
    color: var(--text-color);
    font-style: italic;
}

/* Keep links blue */
.assistant-message a {
    color: var(--primary-color);
    text-decoration: underline;
}

.assistant-message a:hover {
    color: #0b5ed7;
    text-decoration: underline;
}

.assistant-message hr {
    border: none;
    border-top: 2px solid var(--primary-color);
    margin: 1.5rem 0;
    opacity: 0.6;
}

.assistant-message code {
    background-color: var(--bg-color-light);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.welcome-message {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.welcome-message h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

@media (max-width: 600px) {
    .welcome-message {
        margin-bottom: 1.5rem;
        padding: 0 0.75rem;
    }
    .welcome-message h2 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
}

.chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

.suggestion-btn {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.875rem 1rem;
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 52px;
    line-height: 1.4;
}

.suggestion-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

@media (max-width: 600px) {
    .chat-suggestions {
        gap: 0.5rem;
        margin-top: 1rem;
        padding: 0 0.75rem;
    }
    .suggestion-btn {
        padding: 0.75rem;
        font-size: 13px;
        min-height: 48px;
        border-radius: 10px;
    }
}

.chat-response:not(:empty) ~ .welcome-message .chat-suggestions {
    display: none;
}

@media (min-width: 768px) {
    .chat-suggestions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        max-width: 600px;
        gap: 1rem;
    }
    .suggestion-btn {
        flex: 1;
        min-width: 180px;
        max-width: 200px;
        text-align: center;
        justify-content: center;
        padding: 1rem;
        font-size: 14px;
    }
    .welcome-message h2 {
        font-size: 1.75rem;
    }
}

.chat-input-container {
    padding: 1rem 1.5rem;
    background-color: var(--bg-color-light);
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

@media (max-width: 600px) {
    .chat-input-container {
        padding: 0.875rem 1rem;
    }
}

.chat-form {
    max-width: none;
    margin: 0;
    width: 100%;
}

@media (min-width: 768px) {
    .chat-form {
        max-width: 600px;
        margin: 0 auto;
    }
    .chat-input-container {
        display: flex;
        justify-content: center;
        position: sticky;
        bottom: 0;
    }
    .main-content.chat-active .chat-form {
        max-width: 600px;
    }
    .main-content.chat-active .chat-input-container {
        padding: 0.5rem 0;
        position: sticky;
        bottom: 0;
    }
}

.chat-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.3);
    transition: box-shadow 0.2s ease;
    min-height: 52px;
}

@media (max-width: 600px) {
    .chat-input-wrapper {
        padding: 0.625rem 0.875rem;
        gap: 0.625rem;
        min-height: 48px;
        border-radius: 20px;
    }
}

.chat-input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.5), 0 0 15px rgba(255, 193, 7, 0.3);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    font-size: 16px;
    font-family: inherit;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
    overflow-y: auto;
    padding: 0;
    margin: 0;
}

.chat-input::placeholder {
    color: var(--text-color);
    opacity: 0.6;
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 16px;
    font-style: normal;
    letter-spacing: 0.01em;
}

.chat-submit-btn {
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
}

@media (max-width: 600px) {
    .chat-submit-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

.chat-submit-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

.chat-submit-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

.submit-icon {
    line-height: 1;
}

/* --- Footer --- */
.footer {
    background-color: var(--bg-color-light);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 1rem 0;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.footer-brand {
    display: flex;
    flex-direction: column;
}

.footer-logo {
    height: 40px;
    width: auto;
    max-width: 200px;
    margin-bottom: 1rem;
}

.footer-tagline {
    color: var(--text-color);
    font-size: 14px;
    margin: 0;
}

.footer-contact h5 {
    color: var(--heading-color);
    margin-bottom: 1rem;
    font-size: 16px;
}

.footer-contact p {
    color: var(--text-color);
    margin-bottom: 0.75rem;
    font-size: 14px;
    line-height: 1.6;
}

.footer-contact .phone-number,
.footer-contact .email-address {
    color: var(--primary-color);
    font-weight: 500;
}

.footer-contact .hours {
    color: var(--text-color);
    font-size: 12px;
    opacity: 0.8;
    display: block;
    margin-top: 0.25rem;
}

.footer-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0 1rem 0;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-copyright {
    color: var(--text-color);
    font-size: 13px;
}

.footer-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* --- Back to Top Button --- */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #0b5ed7 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
    transition: all 0.3s ease;
}

.back-to-top:hover {
    background: linear-gradient(135deg, #0b5ed7 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.4);
}

.back-to-top.show {
    display: flex;
}

.back-to-top::before {
    content: "↑";
    line-height: 1;
}

/* --- Loading Indicators --- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.htmx-indicator {
    display: none;
    align-items: center;
    color: var(--text-color);
    margin-left: 1rem;
    font-size: 14px;
}

.htmx-request .htmx-indicator {
    display: flex;
}

.htmx-request .htmx-indicator + span {
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes chat-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Cool loading glow effect for buttons */
.loading-glow {
    position: relative;
    animation: glow-pulse 2s ease-in-out infinite alternate;
    z-index: 1;
    /* Override button transitions and transforms during loading */
    transition: none !important;
    transform: none !important;
}

.loading-glow::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, 
        var(--primary-color), 
        var(--warning-color), 
        var(--primary-color), 
        var(--warning-color));
    background-size: 300% 300%;
    border-radius: 9px;
    z-index: -1;
    animation: gradient-shift 3s ease infinite;
    opacity: 0.6;
}

@keyframes glow-pulse {
    0% {
        box-shadow: 0 0 8px rgba(255, 193, 7, 0.4),
                    0 0 15px rgba(255, 193, 7, 0.2),
                    0 0 20px rgba(13, 110, 253, 0.1);
        filter: brightness(1.05);
    }
    100% {
        box-shadow: 0 0 12px rgba(255, 193, 7, 0.6),
                    0 0 20px rgba(255, 193, 7, 0.3),
                    0 0 25px rgba(13, 110, 253, 0.15);
        filter: brightness(1.1);
    }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- travel Result Styles --- */
.travel-content {
    margin: 0.5rem 0;
}

.travel-content .content-text {
    color: var(--text-color);
    line-height: 1.6;
    padding: 1rem;
    background-color: var(--bg-color-light);
    border-radius: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.travel-content .content-text h1 {
    color: var(--heading-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.travel-content .content-text h2 {
    color: var(--heading-color);
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem 0;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.travel-content .content-text h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
}

.travel-content .content-text strong {
    color: var(--heading-color);
    font-weight: 600;
}

.travel-content .content-text ul,
.travel-content .content-text ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.travel-content .content-text li {
    margin: 0.25rem 0;
    line-height: 1.4;
}

.travel-content .content-text p {
    margin: 0.75rem 0;
    line-height: 1.5;
}

/* --- Fundraising Result Styles --- */
.fundraising-result {
    color: var(--text-color);
}

.fundraising-result .result-header h3 {
    color: var(--heading-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.fundraising-overview {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #4a5568;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
}

.fundraising-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.fundraising-badge {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid #1e40af;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.fundraising-ideas {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.copy-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.fundraising-idea {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border: 1px solid #475569;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.fundraising-idea h4 {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: white;
    margin: 0;
    padding: 1.25rem 1.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border: none;
}

.fundraising-idea .idea-section {
    margin: 0;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #475569;
    background: rgba(30, 41, 59, 0.5);
}

.fundraising-idea .idea-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.fundraising-idea .idea-section:nth-child(even) {
    background: rgba(51, 65, 85, 0.3);
}

.fundraising-idea .idea-section strong {
    color: #0ea5e9;
    font-weight: 700;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fundraising-idea .description-content,
.fundraising-idea .suitability-content,
.fundraising-idea .potential-content,
.fundraising-idea .steps-content {
    color: #e2e8f0;
    margin: 0.5rem 0;
    line-height: 1.7;
    font-size: 1rem;
    white-space: pre-line;
    word-wrap: break-word;
    font-weight: 400;
}

.fundraising-idea .idea-section p {
    color: #e2e8f0;
    margin: 0.75rem 0;
    line-height: 1.7;
    font-size: 1rem;
}

.fundraising-idea .action-plan,
.fundraising-idea .key-roles {
    background: linear-gradient(135deg, #155e75 0%, #0e7490 100%);
    border-left: 4px solid #06b6d4;
    padding: 1.25rem;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 4px 6px rgba(6, 182, 212, 0.1);
}

.fundraising-idea .action-plan h4,
.fundraising-idea .key-roles h4 {
    color: #a5f3fc;
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    border: none;
    padding: 0;
    font-weight: 600;
}

.fundraising-idea .action-plan p,
.fundraising-idea .key-roles p {
    color: #e2e8f0;
    margin: 0.75rem 0;
    line-height: 1.6;
}

.fundraising-idea .action-plan strong,
.fundraising-idea .key-roles strong {
    color: #67e8f9;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: block;
    font-weight: 600;
}

.fundraising-idea .action-plan ul,
.fundraising-idea .key-roles ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.fundraising-idea .action-plan li,
.fundraising-idea .key-roles li {
    color: #e2e8f0;
    margin: 0.75rem 0;
    line-height: 1.6;
    position: relative;
}

.fundraising-idea .action-plan li::marker,
.fundraising-idea .key-roles li::marker {
    color: #67e8f9;
}

.fundraising-idea .action-plan h4:not(:first-child),
.fundraising-idea .key-roles h4:not(:first-child) {
    margin-top: 1.5rem;
    color: #a5f3fc;
    border-top: 1px solid rgba(167, 243, 252, 0.3);
    padding-top: 1rem;
}

.fundraising-idea div {
    margin: 0.75rem 0;
    color: #e2e8f0;
    font-size: 1rem;
    line-height: 1.7;
}

.fundraising-idea strong {
    color: #0ea5e9;
    font-weight: 600;
}

.idea-item {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border: 1px solid #475569;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.idea-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    padding: 1.25rem 1.5rem;
    border-bottom: none;
}

.idea-header h4 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.idea-description {
    padding: 1.25rem 1.5rem;
    color: #e2e8f0;
    margin: 0;
    line-height: 1.6;
    font-size: 1rem;
    background: rgba(30, 41, 59, 0.5);
}

.idea-steps,
.idea-suitability,
.idea-potential {
    padding: 0.5rem 1.25rem;
    color: var(--text-color);
    font-size: 0.9rem;
}

.idea-steps:last-child,
.idea-suitability:last-child,
.idea-potential:last-child {
    padding-bottom: 1rem;
}

.idea-steps strong,
.idea-suitability strong,
.idea-potential strong {
    color: var(--heading-color);
    font-weight: 600;
}

/* --- Practice Schedule Result Styles --- */
.schedule-content {
    color: var(--text-color);
}

.practice-item {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: rgba(30, 41, 59, 0.4); /* More subtle, semi-transparent background */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.practice-item:hover {
    background-color: rgba(30, 41, 59, 0.6); /* Slightly more visible on hover */
    border-color: rgba(66, 133, 244, 0.3); /* Subtle primary color hint */
}

.practice-item h4 {
    color: var(--heading-color);
    margin: 0 0 0.5rem 0;
}

.practice-item p {
    color: var(--text-color);
    margin: 0;
}

/* Practice schedule section descriptions with light backgrounds */
.section-description {
    background-color: rgba(255, 255, 255, 0.9) !important; /* Light background for better readability */
    color: #2d3748 !important; /* Dark text for contrast */
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.practice-raw {
    color: var(--text-color);
    white-space: pre-wrap;
    background-color: var(--bg-color-light);
    padding: 1rem;
    border-radius: 6px;
    line-height: 1.7;
    font-family: inherit;
}

.practice-schedule-result .practice-raw,
.response-area .practice-raw {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}

/* --- Profile Page Styles --- */
.profile-container {
    min-height: 100vh;
    padding: 80px 2rem 2rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.profile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.profile-subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.profile-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-icon {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.form-grid {
    display: grid;
    gap: 1.5rem;
}

.form-label {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input,
.form-select {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%23888' d='M0 0l4 4 4-4H0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 8px 8px;
    padding-right: 2.5rem;
}

.checkbox-section {
    margin-top: 1rem;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-item:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.checkbox-item label {
    margin: 0;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-color);
}

.completion-section {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
}

.completion-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.completion-text {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.completion-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 48px;
    align-items: center;
}

.completion-buttons .btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Password Change Styles */
.password-change-section {
    border: 2px solid var(--accent-color);
    background: linear-gradient(135deg, 
        rgba(247, 195, 46, 0.05) 0%, 
        rgba(6, 106, 201, 0.05) 100%);
}

.password-change-section .card-title {
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input {
    padding-right: 45px !important;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: color 0.2s ease;
    z-index: 2;
}

.password-toggle-btn:hover {
    color: var(--accent-color);
}

.password-strength-indicator,
.password-match-indicator {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    display: none;
}

.password-strength-indicator.weak {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: block;
}

.password-strength-indicator.medium {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
    display: block;
}

.password-strength-indicator.strong {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    display: block;
}

.password-match-indicator.match {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    display: block;
}

.password-match-indicator.no-match {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: block;
}

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Profile Page Responsive Design */
@media (max-width: 768px) {
    .profile-container {
        padding: 70px 1rem 1rem 1rem;
    }
    
    .profile-title {
        font-size: 2rem;
    }
    
    .profile-subtitle {
        font-size: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .completion-buttons {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0.75rem;
    }
    
    .card-header {
        padding-bottom: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .form-input, .form-select {
        padding: 0.75rem;
        font-size: 16px;
    }
    
    button, .checkbox-item {
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .profile-container {
        padding: 60px 0.5rem 0.5rem 0.5rem;
    }
    
    .profile-card {
        padding: 1.25rem;
        border-radius: 8px;
    }
    
    .form-grid {
        gap: 1rem;
    }
    
    .form-label {
        font-size: 0.8rem;
    }
}

/* Extra small screens - single column forms */
@media (max-width: 480px) {
    .form-row,
    .form-row.two-col {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Small screens (phones) - single column forms */
@media (max-width: 600px) {
    .main-container {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 1.5rem 0 1rem 0;  /* Increased top padding from 1rem to 1.5rem for mobile breathing room */
    }
    .sidebar {
        display: none !important;
    }
    .mobile-tools-nav {
        display: block;
        padding: 0.75rem 0.5rem;
    }
    .main-content {
        margin: 0 0.5rem 0.5rem 0.5rem;
        padding: 1rem 0.75rem;
        border-radius: 0;
    }
    .mobile-hidden {
        display: none;
    }
    .form-row,
    .form-row.two-col {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    .mobile-tool-button {
        min-height: 45px;
        padding: 0.4rem 0.4rem;
    }
    .tool-icon {
        font-size: 1.1rem;
        margin-bottom: 0.3rem;
    }
    .tool-name {
        font-size: 10px;
    }
    
    /* Duration badge positioning for mobile - hide it to reduce clutter */
    .duration-badge {
        display: none !important;
    }
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1rem;
        text-align: center;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        padding: 0 1rem;
    }
    .footer-logo {
        height: 35px;
        max-width: 180px;
        align-self: center;
    }
}

/* Medium screens (tablets in portrait) - 2 column forms */
@media (min-width: 601px) and (max-width: 768px) {
    .sidebar {
        display: none !important;
    }
    .main-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .form-row {
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
    }
    .form-row.two-col {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

/* Tablets and small laptops - better form spacing */
@media (min-width: 769px) and (max-width: 992px) {
    .form-row {
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
    }
    .form-row.two-col {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

/* Large tablets and small laptops - 2 or 3 columns based on content */
@media (min-width: 993px) and (max-width: 1200px) {
    .main-container {
        padding: 0 2rem 2rem 2rem;
        gap: 2rem;
    }
    
    /* Allow 3 columns but with more breathing room */
    .form-row {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1.25rem;
    }
    
    /* Keep 2 columns for .two-col class */
    .form-row.two-col {
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem;
    }
}

/* Extra large screens - full 3 columns with generous spacing */
@media (min-width: 1201px) {
    .main-container {
        gap: 3rem;
    }
    .sidebar {
        min-width: 320px;
    }
    
    .form-row {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1.5rem;
    }
    
    .form-row.two-col {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
}

/* Additional responsive improvements for footer */
@media (max-width: 768px) {
    .footer {
        padding: 2rem 0 1rem 0;
        margin-top: 2rem;
    }
}

/* Practice Generator Equipment Section Mobile Improvements */
.practice-equipment-section {
    margin-top: 0.75rem; 
    padding: 0.6rem; 
    background: #ebf8ff; 
    border-radius: 6px; 
    border: 1px solid #bee3f8;
}

.practice-equipment-items {
    display: flex; 
    flex-wrap: wrap; 
    gap: 0.75rem; 
    align-items: center;
}

.practice-equipment-item {
    display: flex; 
    align-items: center; 
    color: #2b6cb0;
}

@media (max-width: 768px) {
    .practice-equipment-items {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .practice-equipment-item {
        width: 100%;
        flex-wrap: wrap;
    }
}

/*
===============================================================================
AUTHGATE MODAL SYSTEM STYLES
===============================================================================
*/

/* AuthGate Modal Base Styles */
.authgate-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.authgate-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.authgate-modal-content {
    position: relative;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: authgate-modal-slide-in 0.3s ease-out;
}

@media (min-width: 768px) {
    .authgate-modal-content {
        max-width: 520px;
    }
}

@keyframes authgate-modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.authgate-modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid #475569;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.authgate-modal-header h2 {
    margin: 0;
    color: #ffc107;
    font-size: 1.25rem;
}

.authgate-modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.authgate-modal-close:hover {
    background: #374151;
    color: #fff;
}

/* Modal Body */
.authgate-modal-body {
    padding: 1.25rem;
}

.authgate-action-preview {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 197, 253, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 0.875rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.authgate-action-preview p {
    margin: 0;
    color: #e2e8f0;
    font-weight: 500;
}

/* Benefits Section */
.authgate-benefits {
    margin-bottom: 1.25rem;
}

.authgate-benefits h3 {
    color: #3b82f6;
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
}

.authgate-benefits-list {
    margin: 0;
    color: #e2e8f0;
}

.authgate-benefit-item {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Sign-in Prompt */
.authgate-signin-prompt {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(147, 197, 253, 0.06) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    padding: 0.75rem 1.25rem; /* Adjusted padding for better fit */
    margin: 1rem 0;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);
    position: relative;
    
    /* Flexbox alignment */
    display: flex;
    flex-direction: row; /* Align items horizontally */
    align-items: center; /* Vertically center the text and button */
    justify-content: space-between; /* Push items to opposite ends */
}

.authgate-signin-prompt::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.4), transparent);
}

.authgate-signin-prompt p {
    margin: 0;
    color: #e2e8f0;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.015em;
    line-height: 1.4;
    text-align: left; /* Ensure text aligns to the left */
}

.authgate-signin-prompt a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 8px;
    display: inline-block;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    transition: all 0.2s ease;
    font-size: 15px;
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.3);
    min-width: 140px;
    text-align: center;
    white-space: nowrap;
}

.authgate-signin-prompt a:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.authgate-signin-prompt a:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

/* Form Elements */
.authgate-form-group {
    margin-bottom: 0.875rem;
}

.authgate-form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: #e2e8f0;
    font-weight: 500;
    font-size: 0.9rem;
}

.authgate-form-group input[type="email"],
.authgate-form-group input[type="password"],
.authgate-form-group input[type="text"] {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #475569;
    border-radius: 6px;
    background: #334155;
    color: #e2e8f0;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.authgate-form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.authgate-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.4;
}

.authgate-checkbox-label input[type="checkbox"] {
    margin: 0;
    margin-top: 0.1rem;
    accent-color: #3b82f6;
    flex-shrink: 0;
}

.authgate-checkbox-label a {
    color: #3b82f6;
    text-decoration: none;
}

.authgate-checkbox-label a:hover {
    text-decoration: underline;
}

/* Buttons */
.authgate-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.authgate-submit-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.authgate-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Footer */
.authgate-footer {
    text-align: center;
    border-top: 1px solid #475569;
    padding-top: 1rem;
}

.authgate-footer p {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: #94a3b8;
}

.authgate-link {
    color: #3b82f6;
    text-decoration: none;
}

.authgate-link:hover {
    text-decoration: underline;
}

/* Messages */
.authgate-messages {
    margin-bottom: 1rem;
}

.authgate-message {
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.authgate-message.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.authgate-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Verification Step Styles */
.authgate-verification-info {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
}

.authgate-verification-info h3 {
    margin: 0 0 0.5rem 0;
    color: #3b82f6;
    font-size: 1.2rem;
}

.authgate-verification-info p {
    margin: 0.25rem 0;
    color: #e2e8f0;
    font-size: 0.9rem;
}

.authgate-email-display {
    font-weight: 600;
    color: #3b82f6 !important;
    font-size: 1rem !important;
}

.authgate-form-hint {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

.authgate-resend-section {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #475569;
}

.authgate-resend-section p {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: #94a3b8;
}

.authgate-link-btn {
    background: none;
    border: none;
    color: #3b82f6;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
}

.authgate-link-btn:hover {
    color: #2563eb;
}

.authgate-step {
    transition: opacity 0.3s ease;
}

/* Code Input Styling */
#authgate-code {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.25rem;
    font-family: monospace;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .authgate-modal {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .authgate-modal-content {
        max-width: 100%;
        max-height: calc(100vh - 40px);
        margin-top: 0;
    }
    
    .authgate-modal-header {
        padding: 1rem;
    }
    
    .authgate-modal-header h2 {
        font-size: 1.2rem;
    }
    
    .authgate-modal-body {
        padding: 1rem;
    }
    
    /* Enhanced mobile styling for signin prompt */
    .authgate-signin-prompt {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 10px;
        gap: 0.625rem;
    }
    
    .authgate-signin-prompt p {
        font-size: 14px;
        margin: 0;
        line-height: 1.4;
    }
    
    .authgate-signin-prompt a {
        padding: 12px 20px;
        font-size: 14px;
        border-radius: 8px;
        min-width: 120px;
        box-shadow: 0 3px 8px rgba(59, 130, 246, 0.3);
    }
    
    .authgate-signin-prompt a:hover {
        transform: translateY(-1px);
    }
    
    /* Adjust form elements for mobile */
    .authgate-form-group {
        margin-bottom: 1rem;
    }
    
    .authgate-form-group input[type="email"],
    .authgate-form-group input[type="password"],
    .authgate-form-group input[type="text"] {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 8px;
    }
    
    .authgate-submit-btn {
        padding: 14px 1.5rem;
        font-size: 16px;
        border-radius: 10px;
    }
    
    /* Benefits section mobile adjustments */
    .authgate-benefits {
        margin-bottom: 1.25rem;
    }
    
    .authgate-benefits h3 {
        font-size: 0.95rem;
    }
    
    .authgate-benefit-item {
        font-size: 0.85rem;
        margin-bottom: 0.35rem;
    }
    
    /* Action preview mobile adjustments */
    .authgate-action-preview {
        padding: 12px;
        margin-bottom: 1.25rem;
        border-radius: 8px;
    }
    
    .authgate-action-preview p {
        font-size: 14px;
    }
    
    /* Verification step mobile adjustments */
    .authgate-verification-info {
        padding: 12px;
        margin-bottom: 1.25rem;
    }
    
    .authgate-verification-info h3 {
        font-size: 1.1rem;
    }
    
    .authgate-verification-info p {
        font-size: 0.85rem;
    }
    
    .authgate-email-display {
        font-size: 0.9rem !important;
    }
    
    /* Checkbox label mobile adjustments */
    .authgate-checkbox-label {
        font-size: 0.8rem;
        gap: 0.4rem;
    }
    
    .authgate-checkbox-label input[type="checkbox"] {
        transform: scale(1.1);
    }
}

/* Extra Small Screens (phones in portrait) */
@media (max-width: 380px) {
    .authgate-modal {
        padding: 5px;
        padding-top: 10px;
    }
    
    .authgate-modal-content {
        max-height: calc(100vh - 20px);
    }
    
    .authgate-modal-header,
    .authgate-modal-body {
        padding: 0.75rem;
    }
    
    .authgate-modal-header h2 {
        font-size: 1.1rem;
    }
    
    .authgate-signin-prompt {
        padding: 0.875rem 12px;
        margin: 1rem 0;
        border-radius: 8px;
        gap: 0.5rem;
    }
    
    .authgate-signin-prompt p {
        font-size: 13px;
        margin: 0;
    }
    
    .authgate-signin-prompt a {
        padding: 10px 18px;
        font-size: 13px;
        border-radius: 7px;
        min-width: 110px;
    }
}

/* AuthGate Notification Animation */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}