/* ==========================================================================
   Neuraxo Agents - Admin Custom Styles
   Layout moderno e mobile-friendly
   ========================================================================== */

/* --------------------------------------------------------------------------
   Root Variables
   -------------------------------------------------------------------------- */
:root {
    --neuraxo-primary: #6366f1;
    --neuraxo-primary-dark: #4f46e5;
    --neuraxo-secondary: #8b5cf6;
    --neuraxo-success: #10b981;
    --neuraxo-warning: #f59e0b;
    --neuraxo-danger: #ef4444;
    --neuraxo-info: #06b6d4;
    --neuraxo-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

/* --------------------------------------------------------------------------
   Dashboard Welcome Card
   -------------------------------------------------------------------------- */
.dashboard-welcome {
    background: var(--neuraxo-gradient);
    border-radius: 16px;
    padding: 2rem;
    color: white;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.3);
}

.dashboard-welcome h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dashboard-welcome p {
    opacity: 0.9;
    font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Stats Cards
   -------------------------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.stat-card .stat-icon.primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--neuraxo-primary);
}

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

.stat-card .stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--neuraxo-warning);
}

.stat-card .stat-icon.info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--neuraxo-info);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.stat-card .stat-change {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-card .stat-change.positive {
    color: var(--neuraxo-success);
}

.stat-card .stat-change.negative {
    color: var(--neuraxo-danger);
}

/* --------------------------------------------------------------------------
   Mobile Responsiveness
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    /* Sidebar improvements */
    [data-sidebar] {
        width: 280px !important;
    }

    /* Cards em coluna no mobile */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Tabelas responsivas */
    .results table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Formularios empilhados */
    .form-row {
        flex-direction: column;
    }

    .form-row > div {
        width: 100% !important;
        margin-left: 0 !important;
    }

    /* Botoes maiores para touch */
    .btn, button, input[type="submit"] {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
    }

    /* Padding geral */
    .dashboard-welcome {
        padding: 1.5rem;
    }

    .dashboard-welcome h1 {
        font-size: 1.5rem;
    }
}

/* --------------------------------------------------------------------------
   Quick Actions Panel
   -------------------------------------------------------------------------- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    text-decoration: none;
    color: #374151;
    transition: all 0.2s ease;
    text-align: center;
}

.quick-action-btn:hover {
    border-color: var(--neuraxo-primary);
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-2px);
}

.quick-action-btn .material-symbols-outlined {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--neuraxo-primary);
}

.quick-action-btn span:last-child {
    font-size: 0.875rem;
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   List Display Improvements
   -------------------------------------------------------------------------- */
#result_list {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

#result_list th {
    background: #f9fafb;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #6b7280;
}

#result_list td {
    vertical-align: middle;
}

#result_list tr:hover td {
    background: rgba(99, 102, 241, 0.03);
}

/* Status badges melhorados */
.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-status.active {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge-status.inactive {
    background: rgba(107, 114, 128, 0.1);
    color: #4b5563;
}

.badge-status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* --------------------------------------------------------------------------
   Form Improvements
   -------------------------------------------------------------------------- */
.form-row {
    margin-bottom: 1.5rem;
}

.vTextField, .vURLField, textarea {
    border-radius: 8px !important;
    border: 2px solid #e5e7eb !important;
    padding: 0.75rem 1rem !important;
    transition: border-color 0.2s ease !important;
}

.vTextField:focus, .vURLField:focus, textarea:focus {
    border-color: var(--neuraxo-primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* Fieldsets com estilo moderno */
fieldset {
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    padding: 1.5rem !important;
    margin-bottom: 1.5rem !important;
    background: #fafafa;
}

fieldset h2 {
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #374151 !important;
    padding-bottom: 0.75rem !important;
    margin-bottom: 1rem !important;
    border-bottom: 1px solid #e5e7eb !important;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.button, input[type="submit"], .submit-row input {
    background: var(--neuraxo-gradient) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 0.75rem 1.5rem !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2) !important;
}

.button:hover, input[type="submit"]:hover, .submit-row input:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
}

.button.default {
    background: #f3f4f6 !important;
    color: #374151 !important;
    box-shadow: none !important;
}

.deletelink {
    background: var(--neuraxo-danger) !important;
}

/* --------------------------------------------------------------------------
   Dark Mode Support
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    .stat-card {
        background: #1f2937;
        border-color: #374151;
    }

    .stat-card .stat-value {
        color: #f9fafb;
    }

    .quick-action-btn {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }

    fieldset {
        background: #111827 !important;
        border-color: #374151 !important;
    }

    fieldset h2 {
        color: #f9fafb !important;
        border-color: #374151 !important;
    }
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card, .quick-action-btn {
    animation: fadeIn 0.3s ease forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

/* --------------------------------------------------------------------------
   Loading States
   -------------------------------------------------------------------------- */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--neuraxo-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Empty States
   -------------------------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.empty-state .material-symbols-outlined {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

.empty-state p {
    max-width: 400px;
    margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Tooltips
   -------------------------------------------------------------------------- */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: #1f2937;
    color: white;
    font-size: 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 8px);
}
