/**
 * CSS Modules Index - Sistema pulito senza dipendenze Telegram
 * Main stylesheet che importa tutti i componenti CSS modulari
 */

/* === CORE STYLES === */
@import url('./core/variables.css');
@import url('./core/base.css');
@import url('./core/layout.css');

/* === COMPONENT STYLES === */
@import url('./components/buttons/buttons.css');
@import url('./components/modals/modals.css');
@import url('./components/forms/auth.css');
@import url('./components/filters/filters.css');
@import url('./components/pagination/pagination.css');

/* === FEATURE STYLES === */
@import url('./features/daily-digest/daily-digest.css');
@import url('./features/daily-digest/voice-overlay.css');
@import url('./features/direct-search/container.css');
@import url('./features/direct-search/header.css');
@import url('./features/direct-search/results.css');
@import url('./features/direct-search/status.css');
@import url('./features/direct-search/mobile.css');
@import url('./features/chat/chat.css');
@import url('./features/chat/rag.css');

/* === UTILITY STYLES === */
@import url('./utilities/animations/animations.css');
@import url('./utilities/responsive/responsive.css');
@import url('./utilities/validation.css');

/* === MAIN APP STYLES === */
@import url('./main.css');

/* === DIGEST GENERATION MESSAGE === */
.digest-generation-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-top);
}

.digest-message-content {
    background: var(--bg-card);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    margin: 0 1rem;
    box-shadow: var(--shadow-lg);
}

.digest-message-content p {
    margin: 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.digest-message-content p:first-child {
    font-weight: var(--font-weight-bold);
    font-size: 1.3rem;
    color: var(--primary-color);
}

/* === AI DISCLAIMERS === */
.digest-ai-disclaimer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--separator-color);
}

.digest-ai-disclaimer span {
    font-size: var(--font-size-xs);
    color: var(--text-hint);
    font-style: italic;
}

.ai-disclaimer {
    font-size: var(--font-size-xs) !important;
    color: var(--text-hint) !important;
    display: block;
    text-align: center;
    margin-top: 0.5rem;
    font-style: italic;
    line-height: var(--line-height-tight);
}

/* === GLOBAL RESET & BASE STYLES === */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
                'Ubuntu', 'Cantarell', 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100%;
    overflow-x: hidden;
}

body {
    transition: background-color var(--transition-normal),
                color var(--transition-normal);
}

/* === SMOOTH SCROLLING === */
html {
    scroll-behavior: smooth;
}

/* === UTILITY CLASSES === */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-weight-bold { font-weight: var(--font-weight-bold); }
.font-weight-normal { font-weight: var(--font-weight-normal); }

.m-0 { margin: 0; }
.p-0 { padding: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mb-2 { margin-bottom: var(--spacing-md); }

/* === FOCUS STYLES === */
:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 2px;
}

/* === AUTH LOADING SCREEN === */
.auth-loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.auth-loading-content {
    text-align: center;
    color: var(--text-primary);
}

.auth-loading-content .auth-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 2rem;
    border-radius: var(--border-radius);
}

.auth-loading-spinner {
    margin: 2rem 0;
}

.auth-loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--separator-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.auth-loading-content p {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    margin: 1rem 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === RAG INITIALIZATION LOADING SCREEN === */
.rag-init-loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.rag-init-loading-content {
    text-align: center;
    color: var(--text-primary);
}

.rag-init-loading-content .auth-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 2rem;
    border-radius: var(--border-radius);
}

.rag-init-loading-spinner {
    margin: 2rem 0;
}

.rag-init-loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--separator-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.rag-init-loading-content p {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    margin: 1rem 0;
}

.rag-init-status {
    margin-top: 1rem;
}

.rag-init-status span {
    font-size: var(--font-size-sm);
    color: var(--text-hint);
    font-style: italic;
}

/* === PRINT STYLES === */
@media print {
    .digest-generation-message,
    .loading-overlay,
    .modal-overlay,
    .auth-loading-screen,
    .rag-init-loading-screen {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}