/* CRITICAL: Force Modern Layout Styles */
.trading-bot-layout {
    display: flex !important;
    min-height: 100vh !important;
    background: #0a0e27 !important;
}

.trading-bot-layout.collapsed .modern-sidebar {
    width: 80px !important;
}

.trading-bot-layout.collapsed .main-area {
    margin-left: 80px !important;
}

.trading-bot-layout.collapsed .sidebar-brand {
    padding: 1.5rem 0.75rem !important;
    justify-content: center !important;
}

.trading-bot-layout.collapsed .brand-container {
    justify-content: center !important;
}

.trading-bot-layout.collapsed .menu-item {
    justify-content: center !important;
    padding: 1rem 0 !important;
}

.trading-bot-layout.collapsed .item-text {
    display: none !important;
}

.modern-sidebar {
    width: 280px !important;
    background: linear-gradient(180deg, #1a1f3a 0%, #0f1629 100%) !important;
    border-right: 1px solid rgba(99, 102, 241, 0.15) !important;
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    z-index: 1000 !important;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.sidebar-brand {
    padding: 1.75rem 1.5rem !important;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1) !important;
    display: flex !important;
}

.brand-logo {
    width: 3.5rem !important;
    height: 3.5rem !important;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    border-radius: 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.sidebar-menu {
    flex: 1 !important;
    padding: 1.5rem 0 !important;
}

.menu-item {
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    padding: 1rem 1.5rem !important;
    color: #94a3b8 !important;
    text-decoration: none !important;
    border-left: 3px solid transparent !important;
    font-weight: 600 !important;
}

.menu-item:hover {
    background: rgba(99, 102, 241, 0.08) !important;
    color: #cbd5e1 !important;
}

.menu-item.active {
    background: rgba(99, 102, 241, 0.12) !important;
    border-left-color: #6366f1 !important;
    color: #6366f1 !important;
}

.item-icon {
    font-size: 1.375rem !important;
}

.main-area {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    margin-left: 280px !important;
}

.content-header {
    background: #0f1629 !important;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1) !important;
    padding: 1.25rem 2rem !important;
    display: flex !important;
}

.page-content {
    flex: 1 !important;
    padding: 2rem !important;
    background: #0a0e27 !important;
}

/* Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #0a0e27;
    color: #e2e8f0;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0f1629;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Focus States */
button:focus, 
input:focus, 
select:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Common Button Styles */
.btn-primary, .btn-secondary, .btn-outline, .btn-icon {
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
}

.btn-secondary:hover {
    background: #334155;
    border-color: #475569;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    background: transparent;
    color: #6366f1;
    border: 1px solid #6366f1;
}

.btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    background: #1a1f3a;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #1e293b;
    color: #cbd5e1;
}

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

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

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

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

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

/* Utility Classes */
.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.375rem;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #1e293b;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Blazor Error Boundary */
.blazor-error-boundary {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    padding: 1rem 1rem 1rem 3.5rem;
    color: #fecaca;
    border-left: 4px solid #ef4444;
    position: relative;
}

.blazor-error-boundary::before {
    content: "?";
    position: absolute;
    left: 1rem;
    font-size: 1.5rem;
}

.blazor-error-boundary::after {
    content: "Si è verificato un errore nell'applicazione.";
    font-weight: 600;
}

/* Card Effects */
.card-glow {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Status Indicators */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.green {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-dot.red {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.status-dot.yellow {
    background: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

/* Color Classes */
.text-profit {
    color: #10b981 !important;
}

.text-loss {
    color: #ef4444 !important;
}

.text-warning {
    color: #f59e0b !important;
}

.text-info {
    color: #3b82f6 !important;
}

.text-muted {
    color: #64748b !important;
}

/* Background Classes */
.bg-primary {
    background: #6366f1 !important;
}

.bg-success {
    background: #10b981 !important;
}

.bg-danger {
    background: #ef4444 !important;
}

.bg-dark {
    background: #0f1629 !important;
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge.danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge.info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

/* Responsive Utilities */
@media (max-width: 1024px) {
    html {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 13px;
    }
    
    .modern-sidebar {
        transform: translateX(-100%) !important;
    }
    
    .main-area {
        margin-left: 0 !important;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
    background: #1a1f3a;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 500px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #e2e8f0;
    margin: 0;
}

.btn-close {
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.modal-body ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.modal-body li {
    margin: 0.5rem 0;
    color: #cbd5e1;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.text-danger {
    color: #ef4444 !important;
}

/* Danger Button */
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

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

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .sidebar {
        display: none !important;
    }
}