/* Base styles for AI Hub to work with header/footer */
body.ai-hub-page {
    background-color: #1a1a2e; /* Dark background for the page */
    color: #e0e0e0;
    padding-top: 60px; /* Ensure content doesn't hide under the fixed header */
}

main {
    padding: 2rem 5%;
    min-height: calc(100vh - 130px); /* Adjust for header and footer */
}

/* AI Hub Page Styling */
:root {
    --ai-bg: #0d0c22;
    --ai-bg-gradient: linear-gradient(145deg, #0d0c22 0%, #1f1e3d 100%);
    --ai-card-bg: rgba(29, 28, 51, 0.6);
    --ai-card-border: rgba(138, 77, 255, 0.2);
    --ai-glow-1: #8a4dff;
    --ai-glow-2: #3b82f6;
    --ai-glow-3: #14b8a6;
    --ai-text-primary: #ffffff;
    --ai-text-secondary: #a0aec0;
    --ai-shadow: 0 10px 30px -15px rgba(0, 0, 0, 0.3);
}

.ai-hub-container {
    background: var(--ai-bg-gradient);
    color: var(--ai-text-primary);
    padding: 2rem 5%;
    margin-top: 80px;
    min-height: 100vh;
}

.ai-hub-hero {
    text-align: center;
    padding: 6rem 1rem;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-2xl);
    margin-bottom: 4rem;
}

.ai-hub-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(138, 77, 255, 0.1), transparent 70%);
    animation: pulse 5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(0.8); opacity: 0.5; }
}

.ai-hub-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, #e0c3fc, #8ec5fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 15px rgba(224, 195, 252, 0.3);
}

.ai-hub-hero p {
    font-size: 1.5rem;
    color: var(--ai-text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.ai-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    align-items: start;
}

.ai-card {
    background: var(--ai-card-bg);
    border-radius: var(--radius-xl);
    padding: 2rem;
    border: 1px solid var(--ai-card-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--ai-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ai-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px -15px rgba(138, 77, 255, 0.3);
}

.ai-card.large-card {
    grid-column: span 1 / span 1;
}

@media (min-width: 1024px) {
    .ai-card.large-card {
        grid-column: span 2 / span 2;
    }
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ai-glow-1), var(--ai-glow-2));
    color: white;
}

.card-icon svg {
    width: 24px;
    height: 24px;
}

.card-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Specific Card Styles */

/* Chat UI */
.chat-ui {
    display: flex;
    flex-direction: column;
    height: 300px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: rgba(0,0,0,0.2);
}
.chat-messages {
    flex-grow: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
}
.message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    max-width: 80%;
}
.message.bot {
    background: rgba(255, 255, 255, 0.1);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.message.user {
    background: var(--ai-glow-2);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--ai-card-border);
}
.chat-input-area input {
    flex-grow: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--ai-card-border);
    color: white;
}

/* Homework Help & Uploads */
textarea {
    min-height: 120px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--ai-card-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    color: white;
    resize: vertical;
}

button {
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    background: linear-gradient(135deg, var(--ai-glow-1), var(--ai-glow-2));
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(138, 77, 255, 0.5);
}

.upload-text, .tool-description {
    color: var(--ai-text-secondary);
    text-align: center;
    margin-bottom: 1rem;
}

.upload-btn {
    width: 100%;
    background: rgba(255,255,255,0.1);
    border: 1px dashed var(--ai-card-border);
}
.upload-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* Attendance Analyzer */
.chart-placeholder {
    width: 100%;
    height: 250px;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid var(--ai-card-border);
}

.sample-stats {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-top: 1.5rem;
}

.stat {
    text-align: center;
}

.stat h4 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--ai-glow-3), var(--ai-glow-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat p {
    color: var(--ai-text-secondary);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-hub-hero h1 {
        font-size: 2.5rem;
    }
    .ai-hub-hero p {
        font-size: 1.1rem;
    }
    .ai-cards-grid {
        grid-template-columns: 1fr;
    }
    .sample-stats {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
    }

    .stat h4 {
        font-size: 2rem;
    }

    .card-header {
        align-items: flex-start;
    }

    .card-header h3 {
        font-size: 1.2rem;
        line-height: 1.4;
    }

    .chart-placeholder {
        height: auto;
        min-height: 200px;
        padding: 2rem 1rem;
    }
}

.ai-hub-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    z-index: 1001; /* Ensure title is above the menu */
}

/* Mobile Menu Emergency Fixes */
body.ai-hub-page .main-nav {
    z-index: 9999 !important;
    background: rgba(13, 12, 34, 0.98) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    backdrop-filter: blur(20px) !important;
}

body.ai-hub-page .mobile-menu-toggle {
    z-index: 10000 !important;
    position: relative !important;
}

body.ai-hub-page .main-nav.active {
    transform: none !important;
    right: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.ai-hub-page.menu-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}
