/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Lilly Brand Colors */
    --lilly-red: #E1251B;
    --lilly-red-dark: #C41F17;
    --lilly-pink: #FBCFC8;
    --lilly-black: #212121;
    --lilly-white: #FFFFFF;

    /* Functional Colors (manteniamo per compatibilità) */
    --primary: #E1251B;
    --primary-dark: #C41F17;
    --primary-light: #FBCFC8;
    --secondary: #FBCFC8;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #E1251B;
    --danger-dark: #C41F17;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Grays */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;

    /* Borders */
    --border-color: #e5e7eb;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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);

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background:
        linear-gradient(135deg, var(--lilly-red) 0%, var(--lilly-red-dark) 100%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-blend-mode: overlay;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

/* ===== LAYOUT ===== */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
.app-header {
    background: linear-gradient(135deg, var(--lilly-red) 0%, var(--lilly-red-dark) 100%);
    color: white;
    padding: 24px 32px;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.lilly-logo {
    min-width: 120px;
    height: 48px;
    display: flex;
    align-items: center;
}

.lilly-logo-img {
    height: 55px;
    width: auto;
    display: block;
}

.divider-vertical {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.3);
}

.logo-icon {
    width: 48px;
    height: 48px;
}

.app-header h1 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 4px 0 0 0;
    font-weight: 400;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius-sm);
    backdrop-filter: blur(10px);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-400);
}

.status-indicator.test-mode {
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.connected {
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.disconnected {
    background: var(--danger);
}

.status-text {
    font-size: 14px;
    font-weight: 500;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 32px;
    background: var(--bg-secondary);
    overflow-y: auto;
}

/* ===== STATS BAR ===== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.pending {
    background: rgba(251, 191, 36, 0.1);
    color: var(--warning);
}

.stat-icon.approved {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.rejected {
    background: rgba(225, 37, 27, 0.1);
    color: var(--lilly-red);
}

.stat-icon.total {
    background: rgba(251, 207, 200, 0.2);
    color: var(--lilly-red);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== QUESTIONS CONTAINER ===== */
.questions-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.questions-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.questions-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--border-radius-sm);
}

.filter-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-tab:hover {
    background: rgba(225, 37, 27, 0.1);
    color: var(--lilly-red);
}

.filter-tab.active {
    background: var(--primary);
    color: white;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.filter-tab.active .filter-badge {
    background: rgba(255, 255, 255, 0.25);
}

.filter-tab:hover:not(.active) .filter-badge {
    background: rgba(225, 37, 27, 0.15);
}

/* ===== QUESTIONS LIST ===== */
.questions-list {
    max-height: 600px;
    overflow-y: auto;
}

.empty-state {
    padding: 80px 20px;
    text-align: center;
}

.empty-state svg {
    margin: 0 auto 24px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Question Card */
.question-card {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.question-card:hover {
    background: var(--bg-secondary);
}

.question-card:last-child {
    border-bottom: none;
}

.question-card.status-approved {
    border-left: 4px solid var(--success);
}

.question-card.status-rejected {
    border-left: 4px solid var(--danger);
    opacity: 0.6;
}

.question-card.status-pending {
    border-left: 4px solid var(--warning);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.author-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.question-time {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.question-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.question-status.pending {
    background: rgba(251, 191, 36, 0.1);
    color: var(--warning);
}

.question-status.approved {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.question-status.rejected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.question-status svg {
    width: 14px;
    height: 14px;
}

.question-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.question-actions {
    display: flex;
    gap: 8px;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #f57c00;
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-dark);
    box-shadow: var(--shadow-md);
}

.btn-queue {
    background: #ff9800;
    color: white;
}

.btn-queue:hover:not(:disabled) {
    background: #f57c00;
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-large {
    max-width: 800px;
}

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

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ===== FORMS ===== */
.form-section {
    margin-bottom: 24px;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-textarea {
    resize: vertical;
    line-height: 1.6;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

/* Toggle Switch */
.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.toggle-label:hover {
    background: var(--bg-tertiary);
}

.toggle-label-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toggle-label-text small {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

.toggle-switch {
    position: relative;
    width: 120px;
    height: 36px;
    background: var(--gray-300);
    border-radius: 20px;
    transition: var(--transition);
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 54px;
    height: 30px;
    background: white;
    border-radius: 18px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked ~ .toggle-slider {
    left: 63px;
    background: white;
}

.toggle-switch input:checked {
    background: var(--success);
}

.toggle-label-left,
.toggle-label-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.toggle-label-left {
    left: 12px;
    color: white;
}

.toggle-label-right {
    right: 12px;
    color: var(--text-secondary);
}

.toggle-switch input:checked ~ .toggle-label-left {
    color: var(--text-secondary);
}

.toggle-switch input:checked ~ .toggle-label-right {
    color: white;
}

.toggle-switch input:checked + .toggle-slider {
    background: white;
}

.toggle-switch input:not(:checked) + .toggle-slider {
    background: white;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ===== QUESTION DETAIL ===== */
.question-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    align-items: center;
}

.toast {
    background: white;
    border-radius: var(--border-radius-sm);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--danger);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast.info .toast-icon {
    color: var(--info);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .app-container {
        border-radius: 0;
        min-height: 100vh;
    }

    .app-header {
        padding: 20px;
    }

    .app-header h1 {
        font-size: 20px;
    }

    .subtitle {
        font-size: 13px;
    }

    .main-content {
        padding: 20px;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-value {
        font-size: 24px;
    }

    .questions-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-tabs {
        width: 100%;
        overflow-x: auto;
    }

    .modal-content {
        margin: 20px;
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    .btn {
        flex: 1;
        min-width: 120px;
    }

    .toast-container {
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100% - 40px);
    }
}

/* ===== SCROLLBAR STYLING ===== */
.questions-list::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.questions-list::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.questions-list::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

.questions-list::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===== SOURCE TOGGLE (Email/API ON24) ===== */
.source-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--gray-100);
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.source-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--gray-600);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.source-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--gray-900);
}

.source-btn.active {
    background: white;
    color: var(--primary-600);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.source-btn svg {
    width: 20px;
    height: 20px;
}

/* Info Box */
.info-box {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.info-box svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--primary-600);
}

.info-box strong {
    color: var(--primary-900);
}

.info-box code {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: var(--primary-100);
    color: var(--primary-700);
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    margin: 0.25rem 0;
}

.info-box small {
    display: block;
    margin-top: 0.25rem;
    color: var(--gray-600);
    font-size: 0.8125rem;
}
