/* PoliTech Universal Design System */
/* ================================= */

/* Base styles with consistent font stack */
html, body {
    font-family: 'Inter', 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #ffffff;
    color: #111827;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* PoliTech Color Variables */
:root {
    --politech-primary: #667eea;
    --politech-secondary: #764ba2;
    --politech-tertiary: #4f46e5;
    --politech-success: #10b981;
    --politech-warning: #f59e0b;
    --politech-error: #ef4444;
    --politech-info: #3b82f6;
    --politech-dark: #1f2937;
    --politech-gray-50: #f9fafb;
    --politech-gray-100: #f3f4f6;
    --politech-gray-200: #e5e7eb;
    --politech-gray-300: #d1d5db;
    --politech-gray-400: #9ca3af;
    --politech-gray-500: #6b7280;
    --politech-gray-600: #374151;
    --politech-gray-700: #1f2937;
    --politech-gray-800: #111827;
    --politech-gray-900: #0f172a;
    
    /* Spacing Scale */
    --spacing-xs: 0.25rem;   /* 4px */
    --spacing-sm: 0.5rem;    /* 8px */
    --spacing-md: 0.75rem;   /* 12px */
    --spacing-lg: 1rem;      /* 16px */
    --spacing-xl: 1.5rem;    /* 24px */
    --spacing-2xl: 2rem;     /* 32px */
    --spacing-3xl: 3rem;     /* 48px */
    --spacing-4xl: 4rem;     /* 64px */
    --spacing-5xl: 6rem;     /* 96px */
    
    /* Border Radius Scale */
    --radius-sm: 0.375rem;   /* 6px */
    --radius-md: 0.5rem;     /* 8px */
    --radius-lg: 0.75rem;    /* 12px */
    --radius-xl: 1rem;       /* 16px */
    --radius-2xl: 1.5rem;    /* 24px */
    --radius-full: 9999px;   /* Full rounded */
    
    /* Shadow Scale */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* MudBlazor Component Overrides */
/* ============================= */

/* AppBar styling */
.mud-appbar {
    background-color: #ffffff !important;
    color: var(--politech-gray-800) !important;
    border-bottom: 1px solid var(--politech-gray-200) !important;
    box-shadow: var(--shadow-sm) !important;
}

.mud-appbar .mud-button {
    color: var(--politech-gray-600) !important;
    font-weight: 500 !important;
    text-transform: none !important;
    border-radius: var(--radius-md) !important;
    padding: var(--spacing-sm) var(--spacing-lg) !important;
    margin: 0 var(--spacing-xs) !important;
    transition: all 0.2s ease-in-out !important;
}

.mud-appbar .mud-button:hover {
    background-color: var(--politech-gray-100) !important;
    color: var(--politech-primary) !important;
}

/* Button standardization */
.mud-button {
    text-transform: none !important;
    font-weight: 500 !important;
    border-radius: var(--radius-md) !important;
    transition: all 0.2s ease-in-out !important;
    letter-spacing: 0.025em !important;
}

.mud-button-filled-primary {
    background: linear-gradient(135deg, var(--politech-primary) 0%, var(--politech-secondary) 100%) !important;
    box-shadow: var(--shadow-md) !important;
}

.mud-button-filled-primary:hover {
    box-shadow: var(--shadow-lg) !important;
    transform: translateY(-1px) !important;
}

.mud-button-outlined-primary {
    border-color: var(--politech-primary) !important;
    color: var(--politech-primary) !important;
}

.mud-button-outlined-primary:hover {
    background-color: var(--politech-primary) !important;
    color: white !important;
}

.mud-button-text {
    color: var(--politech-gray-600) !important;
}

.mud-button-text:hover {
    background-color: var(--politech-gray-100) !important;
    color: var(--politech-primary) !important;
}

/* Paper/Card standardization */
.mud-paper {
    border-radius: var(--radius-xl) !important;
    border: 1px solid var(--politech-gray-200) !important;
    background-color: #ffffff !important;
}

.mud-paper.mud-elevation-1 {
    box-shadow: var(--shadow-sm) !important;
}

.mud-paper.mud-elevation-2 {
    box-shadow: var(--shadow-md) !important;
}

.mud-paper.mud-elevation-4 {
    box-shadow: var(--shadow-lg) !important;
}

.mud-paper.mud-elevation-8 {
    box-shadow: var(--shadow-xl) !important;
}

.mud-paper.mud-elevation-10 {
    box-shadow: var(--shadow-2xl) !important;
}

/* Text field standardization */
.mud-input-control .mud-input {
    border-radius: var(--radius-md) !important;
}

.mud-input-outlined .mud-input-outlined-border {
    border-color: var(--politech-gray-300) !important;
    border-radius: var(--radius-md) !important;
}

.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: var(--politech-primary) !important;
}

.mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--politech-primary) !important;
    border-width: 2px !important;
}

/* Icon standardization */
.mud-icon-button {
    border-radius: var(--radius-md) !important;
    transition: all 0.2s ease-in-out !important;
}

.mud-icon-button:hover {
    background-color: var(--politech-gray-100) !important;
}

/* Container and layout improvements */
.mud-container {
    padding-left: var(--spacing-lg) !important;
    padding-right: var(--spacing-lg) !important;
}

@media (min-width: 600px) {
    .mud-container {
        padding-left: var(--spacing-xl) !important;
        padding-right: var(--spacing-xl) !important;
    }
}

@media (min-width: 1200px) {
    .mud-container {
        padding-left: var(--spacing-2xl) !important;
        padding-right: var(--spacing-2xl) !important;
    }
}

/* Standardized spacing utilities - Condensed for better visual flow */
.pt-section { padding-top: var(--spacing-3xl) !important; }
.pb-section { padding-bottom: var(--spacing-3xl) !important; }
.py-section { padding-top: var(--spacing-3xl) !important; padding-bottom: var(--spacing-3xl) !important; }

.pt-section-sm { padding-top: var(--spacing-2xl) !important; }
.pb-section-sm { padding-bottom: var(--spacing-2xl) !important; }
.py-section-sm { padding-top: var(--spacing-2xl) !important; padding-bottom: var(--spacing-2xl) !important; }

.pt-card { padding-top: var(--spacing-xl) !important; }
.pb-card { padding-bottom: var(--spacing-xl) !important; }
.py-card { padding-top: var(--spacing-xl) !important; padding-bottom: var(--spacing-xl) !important; }

.mb-section { margin-bottom: var(--spacing-3xl) !important; }
.mb-section-sm { margin-bottom: var(--spacing-2xl) !important; }
.mb-card { margin-bottom: var(--spacing-xl) !important; }
.mb-element { margin-bottom: var(--spacing-lg) !important; }

/* Consistent page backgrounds */
.page-background {
    background: linear-gradient(135deg, #ffffff 0%, var(--politech-gray-50) 100%);
    min-height: calc(100vh - 64px);
}

.page-background-alt {
    background: linear-gradient(135deg, var(--politech-gray-50) 0%, var(--politech-gray-100) 100%);
    min-height: calc(100vh - 64px);
}

/* Hero section styling */
.hero-gradient {
    background: linear-gradient(135deg, var(--politech-primary) 0%, var(--politech-secondary) 100%);
    color: white;
    border-radius: var(--radius-2xl) !important;
}

.hero-image-container {
    max-width: 400px;
    width: 100%;
}

/* Focus states */
*:focus-visible {
    outline: 2px solid var(--politech-primary);
    outline-offset: 2px;
}

/* Form validation styles */
.valid.modified:not([type=checkbox]) {
    border-color: var(--politech-success) !important;
}

.invalid {
    border-color: var(--politech-error) !important;
}

.validation-message {
    color: var(--politech-error);
    font-size: 0.875rem;
    margin-top: var(--spacing-xs);
}

/* Utility classes */
.text-gradient {
    background: linear-gradient(135deg, var(--politech-primary) 0%, var(--politech-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.border-gradient {
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box, 
                linear-gradient(135deg, var(--politech-primary) 0%, var(--politech-secondary) 100%) border-box;
    border-radius: var(--radius-xl);
}

/* Animation utilities */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Responsive utilities */
@media (max-width: 768px) {
    .text-md-center {
        text-align: center !important;
    }
    
    .hide-mobile {
        display: none !important;
    }
    
    .mud-container {
        padding-left: var(--spacing-lg) !important;
        padding-right: var(--spacing-lg) !important;
    }
    
    /* Mobile hero image adjustments */
    .hero-image-container {
        max-width: 280px !important;
        margin: 0 auto !important;
    }
    
    .hero-image-container img {
        max-height: 200px !important;
    }
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Blazor error UI */
#blazor-error-ui {
    background: var(--politech-error);
    bottom: 0;
    box-shadow: var(--shadow-xl);
    color: white;
    display: none;
    left: 0;
    padding: var(--spacing-lg) var(--spacing-xl);
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: var(--spacing-lg);
    top: var(--spacing-lg);
    font-size: 1.2rem;
}

/* Remove Bootstrap dependency - but preserve authentication forms */
.btn:not([type="submit"]):not(.btn-primary):not(.btn-secondary), 
.card:not(.account-card) {
    display: none !important;
}

/* Keep form controls visible for authentication pages */
.form-control {
    display: block !important;
}

/* Custom styled form controls for login */
.mud-input-control {
    border: 2px solid var(--politech-gray-300) !important;
    border-radius: var(--radius-lg) !important;
    padding: 16px !important;
    font-size: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: border-color 0.3s ease !important;
    background: var(--politech-gray-50) !important;
}

.mud-input-control:focus {
    outline: none !important;
    border-color: var(--politech-primary) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    background: white !important;
}

.mud-input-control:hover {
    border-color: var(--politech-gray-400) !important;
}

/* Style the positioned input containers */
.login-input-container {
    position: relative;
    margin-bottom: var(--spacing-lg);
}

.login-input-label {
    position: absolute;
    top: -8px;
    left: 12px;
    background: white;
    padding: 0 4px;
    font-size: 12px;
    color: var(--politech-gray-600);
    font-weight: 500;
}

/* Style validation messages */
.text-danger {
    color: var(--politech-error) !important;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* Style checkbox for remember me */
.form-check-input {
    margin-right: 8px;
    accent-color: var(--politech-primary);
}

/* AI Response Formatting Styles */
.ai-section-header {
    font-size: 18px;
    font-weight: 700;
    color: var(--politech-primary);
    margin: 16px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--politech-primary);
    line-height: 1.3;
}

.ai-action-item {
    margin: 12px 0 8px 0;
    font-size: 16px;
}

.ai-bold {
    font-weight: 600;
    color: var(--politech-gray-800);
}

.ai-list {
    margin: 8px 0 16px 0;
    padding-left: 20px;
    list-style-type: none;
}

.ai-list-item {
    margin: 6px 0;
    padding-left: 0;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
    color: var(--politech-gray-700);
}

.ai-list-item:before {
    content: "•";
    color: var(--politech-primary);
    font-weight: bold;
    position: absolute;
    left: -15px;
    font-size: 16px;
}

.ai-paragraph {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--politech-gray-700);
}

.ai-question {
    margin: 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--politech-secondary);
    font-style: italic;
    line-height: 1.4;
}

/* Enhanced chat message styling */
.ai-message-container {
    background: linear-gradient(135deg, var(--politech-gray-50) 0%, #ffffff 100%);
    border-left: 4px solid var(--politech-primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

/* Inline bold text within paragraphs */
.ai-inline-bold {
    font-weight: 600;
    color: var(--politech-primary);
}

/* Inline italic text within paragraphs */
.ai-inline-italic {
    font-style: italic;
    color: var(--politech-secondary);
    font-weight: 500;
}

/* Horizontal divider styling */
.ai-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--politech-primary) 20%, var(--politech-secondary) 80%, transparent 100%);
    margin: 20px 0;
    border-radius: 1px;
}

/* ChatGPT-Style Layout */
.chatgpt-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Welcome Screen Styles */
.chatgpt-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #ffffff;
}

.chatgpt-welcome-content {
    max-width: 768px;
    width: 100%;
    text-align: center;
}

.chatgpt-header {
    margin-bottom: 48px;
}

.chatgpt-logo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--politech-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px auto;
    color: white;
}

.chatgpt-title {
    font-size: 32px;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 8px 0;
}

.chatgpt-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
    font-weight: 400;
}

.chatgpt-input-container {
    margin-bottom: 48px;
}

.chatgpt-input-wrapper {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.chatgpt-input-wrapper:focus-within {
    border-color: var(--politech-primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.chatgpt-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    font-size: 16px;
}

.chatgpt-input .mud-input-control {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.chatgpt-input .mud-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.chatgpt-send-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 8px !important;
    background: var(--politech-primary) !important;
    color: white !important;
    flex-shrink: 0;
}

.chatgpt-send-btn:disabled {
    background: #e5e7eb !important;
    color: #9ca3af !important;
}

/* Suggestion Cards */
.chatgpt-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    max-width: 640px;
    margin: 0 auto;
}

.chatgpt-suggestion-card {
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    background: white;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.chatgpt-suggestion-card:hover {
    border-color: var(--politech-primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.suggestion-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--politech-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.suggestion-text {
    flex: 1;
}

.suggestion-title {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 4px;
}

.suggestion-desc {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.4;
}

/* Chat Interface Styles */
.chatgpt-chat {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.chatgpt-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
}

.chatgpt-chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #1f2937;
    font-size: 16px;
}

.chatgpt-new-chat-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 8px !important;
    border: 1px solid #e5e7eb !important;
    background: white !important;
    color: #6b7280 !important;
}

.chatgpt-new-chat-btn:hover {
    background: #f9fafb !important;
}

/* Messages Container */
.chatgpt-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
}

.chatgpt-message {
    display: flex;
    width: 100%;
}

.user-message {
    justify-content: flex-end;
}

.assistant-message {
    justify-content: flex-start;
}

.message-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 80%;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--politech-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-text {
    flex: 1;
    min-width: 0;
}

.user-text {
    background: var(--politech-primary);
    color: white;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.assistant-text {
    background: #f7f7f8;
    color: #1f2937;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

/* Typing Indicator */
.typing-indicator {
    background: #f7f7f8;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dots .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { 
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Bottom */
.chatgpt-input-bottom {
    padding: 24px;
    border-top: 1px solid #e5e7eb;
    background: white;
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
}

.chatgpt-disclaimer {
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 12px;
}

/* AI Response Formatting - Updated for ChatGPT Style */
.assistant-text .ai-section-header {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 16px 0 8px 0;
    padding: 0;
    border: none;
}

.assistant-text .ai-inline-bold {
    font-weight: 600;
    color: #1f2937;
}

.assistant-text .ai-inline-italic {
    font-style: italic;
    color: #4b5563;
}

.assistant-text .ai-list {
    margin: 12px 0;
    padding-left: 20px;
}

.assistant-text .ai-list-item {
    margin: 4px 0;
    color: #374151;
}

.assistant-text .ai-paragraph {
    margin: 8px 0;
    color: #374151;
    line-height: 1.6;
}

.assistant-text .ai-question {
    margin: 8px 0;
    color: #374151;
    font-weight: 500;
}

.assistant-text .ai-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 16px 0;
    border-radius: 0;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chatgpt-welcome-content {
        padding: 0 16px;
    }
    
    .chatgpt-title {
        font-size: 28px;
    }
    
    .chatgpt-suggestions {
        grid-template-columns: 1fr;
    }
    
    .chatgpt-messages {
        padding: 16px;
    }
    
    .chatgpt-input-bottom {
        padding: 16px;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .chatgpt-input-wrapper {
        padding: 10px 14px;
    }
}