:root {
    --primary-color: #2b5797;
    --primary-gradient: linear-gradient(135deg, #2b5797 0%, #1e4175 100%);
    --secondary-color: #3366aa;
    --background-color: #e8e8e8;
    --card-background: #ffffff;
    --text-color: #333;
    --text-light: #666;
    --button-hover: #1e4175;
    --container-padding: 2rem;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    --border-color: #e1e4e8;
    --input-focus: #edf2ff;
    --error-color: #dc3545;
    --accent-color: #d4a520;
}

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    min-height: 100%;
    background-color: var(--background-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--container-padding);
}

/* Logo */
.logo {
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.logo-image {
    width: clamp(120px, 30vw, 200px);
    height: auto;
    border: 3px solid #d4a520;
    border-radius: 50%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 15px rgba(212, 165, 32, 0.2);
    transition: all 0.3s ease;
}

.logo-image:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(212, 165, 32, 0.3);
    border-color: #e6b932;
}

/* Typography */
h1 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    line-height: 1.2;
}

/* Card */
.welcome-message {
    background: white;
    padding: clamp(1rem, 4vw, 2rem);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin: 0 auto;
    max-width: 600px;
}

.welcome-message p {
    font-size: clamp(1rem, 3vw, 1.2rem);
    margin-bottom: 1rem;
}

/* Buttons */
.auth-buttons {
    margin-top: clamp(1.5rem, 4vw, 2rem);
    display: flex;
    gap: clamp(0.5rem, 2vw, 1rem);
    justify-content: center;
    flex-wrap: wrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: clamp(0.6rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    text-align: center;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.button:hover {
    background-color: var(--button-hover);
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

.button-primary {
    background-color: var(--primary-color);
}

.button-primary:hover {
    background-color: var(--button-hover);
}

/* Media Queries */
@media (max-width: 480px) {
    :root {
        --container-padding: 1rem;
    }

    .auth-buttons {
        flex-direction: column;
        width: 100%;
        max-width: 280px;
        margin-left: auto;
        margin-right: auto;
    }

    .button {
        width: 100%;
    }
}

/* Cards */
.welcome-message,
.form-card {
    background: var(--card-background);
    box-shadow: 0 8px 16px var(--shadow-color);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: clamp(1rem, 4vw, 2rem);
    margin: 0 auto;
    max-width: 600px;
}

/* Forms */
.registration-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--input-focus);
}

.help-text {
    font-size: 0.875rem;
    color: #666;
}

.form-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
}

.button-wide {
    flex: 1;
}

.button-text {
    background: none;
    color: var(--text-color);
    padding: 0;
}

.button-text:hover {
    background: none;
    color: var(--primary-color);
    transform: none;
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Dashboard Styles */
.dashboard-card {
    max-width: 800px;
    margin: 0 auto;
}

.tiles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.tile-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: white;
    padding: 25px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.tile-button i {
    font-size: 24px;
    margin-bottom: 10px;
}

.tile-button span {
    font-size: 1rem;
    font-weight: 500;
}

.tile-button:hover {
    background-color: var(--button-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px var(--shadow-color);
}

.tile-button:active {
    transform: translateY(-1px);
}

@media (max-width: 640px) {
    .tiles-grid {
        grid-template-columns: 1fr;
    }
    
    .tile-button {
        padding: 20px;
    }
}

/* High contrast mode */
@media (forced-colors: active) {
    .button {
        border: 2px solid currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .button {
        transition: none;
    }
}

/* Home Page Specific Styles */
.home-page {
    background: #e8e8e8;
    min-height: 100vh;
}

.home-page .container {
    max-width: 1200px;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInUp 0.8s ease-out;
}

.hero-title {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    color: var(--text-color);
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
}

/* Enhanced Welcome Message for Home */
.home-page .welcome-message {
    background: #e8e8e8;
    border: 3px solid #d4a520;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(212, 165, 32, 0.2);
    padding: 3rem 2rem;
    border-radius: 16px;
    max-width: 1000px;
}

/* Benefits Grid */
.benefits-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.benefit-item {
    text-align: center;
    padding: 1.5rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #5b8abd 0%, #4a7ba7 100%);
    backdrop-filter: blur(10px);
    border: 2px solid #d4a520;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.benefit-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(91, 138, 189, 0.3);
    background: linear-gradient(135deg, #4a7ba7 0%, #5b8abd 100%);
    border-color: #e6b932;
}

.benefit-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.benefit-item h3 {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.benefit-item p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

/* CTA Section */
.cta-section {
    background: linear-gradient(135deg, #5b8abd 0%, #4a7ba7 100%);
    padding: 2rem;
    border-radius: 12px;
    margin-top: 2rem;
    border: 2px solid #d4a520;
}

.cta-text {
    font-size: 1.3rem;
    color: white;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

/* Enhanced Buttons for Home */
.home-page .button-primary {
    background: white;
    color: #2b5797;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #d4a520;
    min-width: 180px;
}

.home-page .button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 165, 32, 0.3);
    background: rgba(255, 255, 255, 0.95);
    border-color: #e6b932;
}

.button-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
    padding: 0.9rem 1.8rem;
    font-weight: 600;
}

.button-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: white;
}

/* Footer Text */
.footer-text {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0;
}

.footer-text p {
    color: var(--text-color);
    font-size: 1.1rem;
    font-style: italic;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Responsive adjustments for home page */
@media (max-width: 768px) {
    .benefits-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .hero-title {
        margin-bottom: 0.75rem;
    }
    
    .home-page .welcome-message {
        padding: 2rem 1.5rem;
    }
    
    .cta-section {
        padding: 1.5rem;
    }
}

/* Auth page form card override */
.auth-form-card {
    background: linear-gradient(135deg, #5b8abd 0%, #4a7ba7 100%) !important;
    border: 3px solid #d4a520;
}

/* Auth Form Styling - Uses same classes as home page */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-form .form-group label {
    color: white;
    font-weight: 500;
}

.auth-form .form-group input {
    padding: 0.75rem 1rem;
    border: 2px solid #d4a520;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
}

.auth-form .form-group input:focus {
    outline: none;
    background: white;
    border-color: #e6b932;
    box-shadow: 0 0 0 3px rgba(212, 165, 32, 0.2);
}

.auth-form .help-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
}

/* Auth link styling */
.auth-link {
    color: white;
    font-weight: 600;
    text-decoration: underline;
}

.auth-link:hover {
    color: #d4a520;
}

/* Auth CTA text */
.auth-form .cta-text {
    color: white;
}

/* Override button for auth forms */
.auth-form .button-primary {
    width: 100%;
}

/* Dashboard Styles */
.dashboard-container {
    max-width: 1400px;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

/* Chat Container */
.chat-container {
    min-height: 400px;
    max-height: 80vh;
    height: 600px;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #2b5797 0%, #1e4175 100%) !important;
    border: 3px solid #d4a520;
    position: relative;
    resize: vertical;
    transition: height 0.2s ease;
}

/* Resize handle */
.chat-resize-handle {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 8px;
    cursor: ns-resize;
    background: rgba(212, 165, 32, 0.4);
    border-radius: 4px 4px 0 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

.chat-resize-handle::after {
    content: '⋮⋮⋮';
    letter-spacing: 2px;
}

.chat-resize-handle:hover {
    background: rgba(212, 165, 32, 0.7);
    height: 12px;
    color: white;
}

.chat-container.resizing {
    user-select: none;
}

/* Size variants */
.chat-size-standard {
    height: 600px !important;
}

.chat-size-large {
    height: 800px !important;
}

.chat-size-fullscreen {
    height: calc(100vh - 200px) !important;
}

.chat-header {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-bottom: 2px solid #d4a520;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
}

#chatSizeIndicator {
    color: #d4a520 !important;
    font-weight: 600 !important;
}

.chat-controls span,
.chat-controls #chatSizeIndicator,
span#chatSizeIndicator {
    color: #d4a520 !important;
    background-color: transparent !important;
}

/* Override any default span styling */
.chat-header span {
    color: inherit !important;
}

.chat-header .chat-controls span {
    color: #d4a520 !important;
}

.resize-hint {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.75rem !important;
}

.resize-btn {
    background: rgba(212, 165, 32, 0.2);
    border: 1px solid #d4a520;
    color: #ffffff;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.2s ease;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resize-btn:hover {
    background: rgba(212, 165, 32, 0.5);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(212, 165, 32, 0.3);
}

.chat-title {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    gap: 0.75rem;
    animation: fadeInUp 0.3s ease-out;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.angel-message .message-avatar {
    background: linear-gradient(135deg, #d4a520, #e6b932);
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: rgba(255, 255, 255, 0.3);
}

.message-content {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1rem;
    max-width: 70%;
}

.message-content p {
    color: white;
    margin: 0;
    line-height: 1.5;
}

.user-message .message-content {
    background: rgba(255, 255, 255, 0.25);
}

.chat-input-container {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-top: 2px solid #d4a520;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #d4a520;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    background: white;
    border-color: #e6b932;
    box-shadow: 0 0 0 3px rgba(212, 165, 32, 0.2);
}

.chat-send-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: 2px solid #d4a520;
    color: #2b5797;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(212, 165, 32, 0.3);
    background: #fafafa;
}

/* Quick Actions Panel */
.quick-actions {
    padding: 2rem;
    background: linear-gradient(135deg, #2b5797 0%, #1e4175 100%) !important;
    border: 3px solid #d4a520;
}

.section-title {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.tiles-grid-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tile-button-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid #d4a520;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tile-button-compact i {
    font-size: 2rem;
    color: #d4a520;
    margin-bottom: 0.5rem;
}

.tile-button-compact span {
    color: white;
    font-weight: 500;
    text-align: center;
}

.tile-button-compact:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 6px 20px rgba(212, 165, 32, 0.3);
}

.logout-section {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Typing Indicator */
.typing-indicator .message-content {
    opacity: 0.7;
    animation: pulse 1.5s infinite;
}

.typing-indicator .message-content p {
    font-style: italic;
}

/* Responsive Dashboard */
@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    
    .chat-container {
        height: 500px;
    }
}

@media (max-width: 640px) {
    .tiles-grid-compact {
        grid-template-columns: 1fr;
    }
    
    .message-content {
        max-width: 85%;
    }
}
