/* ============================================================================
   BlockBotter Dashboard UI Comprehensive Fixes & Enhancements
   Professional 5-Star Quality - Security & Performance Optimized
   ============================================================================ */

/* ============================================================================
   1. CONTACT BUTTON & MODAL FIXES (Critical Issue)
   ============================================================================ */

/* Contact Button - Ensure proper contrast */
.navbar .contact-dropdown .contact-btn,
.contact-dropdown .contact-btn,
.contact-btn {
    background: linear-gradient(90deg, #00bfff, #7b61ff) !important;
    color: #FFFFFF !important; /* White text for maximum contrast */
    border: none !important;
    padding: 0.5rem 1.25rem !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.25s ease-in-out !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important; /* Add text shadow for readability */
}

.contact-btn:hover {
    filter: brightness(1.1) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 191, 255, 0.4) !important;
    color: #FFFFFF !important; /* Maintain white text on hover */
}

.contact-btn:active {
    transform: translateY(0);
}

/* Contact Menu Dropdown - Fix white background issue */
.navbar .contact-dropdown .contact-menu,
.contact-dropdown .contact-menu,
.contact-menu,
#contact-menu {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    margin-top: 0.5rem !important;
    background: #1F1F3A !important; /* Dark background - NO WHITE */
    border: 2px solid rgba(0, 228, 255, 0.5) !important;
    border-radius: 8px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6) !important;
    min-width: 200px !important;
    z-index: 10000 !important; /* Increased z-index to ensure visibility */
    overflow: hidden !important;
    padding: 0.25rem 0 !important; /* Remove any white padding */
}

.contact-menu.show,
#contact-menu.show {
    display: block !important;
    animation: slideDown 0.2s ease-out !important;
}

/* Contact Menu Links - Ensure proper contrast */
.navbar .contact-dropdown .contact-menu a,
.contact-dropdown .contact-menu a,
.contact-menu a,
#contact-menu a {
    display: block !important;
    padding: 0.875rem 1.125rem !important;
    color: #FFFFFF !important; /* White text */
    text-decoration: none !important;
    border-bottom: 1px solid rgba(0, 228, 255, 0.3) !important;
    font-weight: 500 !important;
    background: transparent !important; /* NO white background */
    transition: all 0.2s ease !important;
}

.contact-menu a:last-child {
    border-bottom: none !important;
}

.contact-menu a:hover {
    background: rgba(0, 228, 255, 0.25) !important; /* Cyan hover background */
    color: #00E4FF !important; /* Bright cyan text on hover */
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   2. DASHBOARD BALANCE & SPACING IMPROVEMENTS
   ============================================================================ */

/* Consistent card spacing */
.stats-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important; /* Reduced min width from 250px */
    gap: 1rem !important; /* Reduced gap from 1.25rem */
    margin-bottom: 2rem !important;
}

.stat-card {
    background: linear-gradient(145deg, #111a2e, #0b1220) !important;
    border-radius: 12px !important;
    padding: 1rem 1.125rem !important; /* Reduced padding: top/bottom 1rem, left/right 1.125rem */
    border: 1px solid rgba(0, 228, 255, 0.15) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    transition: all 0.3s ease !important;
    position: relative;
    overflow: hidden;
    min-height: auto !important; /* Remove fixed min-height */
}

/* Dashboard header spacing */
.dashboard-header {
    margin-bottom: 2rem !important;
    padding-bottom: 1.5rem !important;
    border-bottom: 2px solid rgba(0, 228, 255, 0.2) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
}

.dashboard-header h1 {
    font-size: 24px !important;
    font-weight: 600 !important;
    margin: 0 !important;
    background: linear-gradient(135deg, #00E4FF 0%, #667eea 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* User info section balance */
.user-info {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    flex-wrap: wrap !important;
}

.plan-badge {
    padding: 0.4rem 0.75rem !important;
    border-radius: 6px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
}

/* ============================================================================
   3. FORM ELEMENTS BALANCE & CONSISTENCY
   ============================================================================ */

/* Form groups - consistent spacing */
.form-group {
    margin-bottom: 1.5rem !important;
}

.form-group label {
    display: block !important;
    margin-bottom: 0.5rem !important;
    font-size: 14px !important;
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 500 !important;
}

/* Input fields - balanced sizing */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
    width: 100% !important;
    max-width: 500px !important; /* Balanced - not too wide */
    padding: 0.75rem 1rem !important;
    background: rgba(31, 31, 58, 0.8) !important;
    border: 2px solid rgba(0, 228, 255, 0.3) !important;
    border-radius: 6px !important;
    color: #FFFFFF !important;
    font-size: 14px !important;
    transition: all 0.25s ease-in-out !important;
}

input:focus,
select:focus,
textarea:focus {
    outline: none !important;
    border-color: #00bfff !important;
    box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.2) !important;
    background: rgba(31, 31, 58, 0.95) !important;
}

/* Select dropdowns - slightly narrower for balance */
select {
    max-width: 400px !important;
}

/* ============================================================================
   4. BUTTON CONSISTENCY & BALANCE
   ============================================================================ */

.btn,
button.btn,
.btn-primary,
button[type="submit"] {
    background: linear-gradient(90deg, #00bfff, #7b61ff) !important;
    color: white !important;
    border: none !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.25s ease-in-out !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    text-transform: none !important;
    letter-spacing: 0.3px;
}

.btn:hover,
button.btn:hover,
.btn-primary:hover,
button[type="submit"]:hover {
    filter: brightness(1.1) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 191, 255, 0.4) !important;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Button sizes - consistent */
.btn-small {
    padding: 0.5rem 1rem !important;
    font-size: 13px !important;
}

.btn-large {
    padding: 1rem 2rem !important;
    font-size: 16px !important;
}

/* ============================================================================
   5. NAVIGATION TABS BALANCE
   ============================================================================ */

.dashboard-tabs-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important; /* Reduced min width from 200px */
    gap: 0.875rem !important; /* Reduced gap from 1rem */
    margin-bottom: 2rem !important;
}

.tab-card-btn {
    background: linear-gradient(145deg, #111a2e, #0b1220) !important;
    border: 1px solid rgba(0, 228, 255, 0.15) !important;
    border-radius: 12px !important;
    padding: 0.875rem 1rem !important; /* Reduced padding: top/bottom 0.875rem, left/right 1rem */
    text-align: center !important;
    text-decoration: none !important;
    color: rgba(255, 255, 255, 0.8) !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.5rem !important;
    min-height: auto !important; /* Remove fixed min-height */
    font-size: 0.875rem !important; /* Slightly smaller font */
}

.tab-card-btn:hover {
    transform: translateY(-2px) !important;
    border-color: rgba(0, 228, 255, 0.4) !important;
    box-shadow: 0 4px 12px rgba(0, 228, 255, 0.2) !important;
    color: #00E4FF !important;
}

.tab-card-btn.active {
    border-color: rgba(0, 228, 255, 0.5) !important;
    background: linear-gradient(145deg, #1a2540, #0f172a) !important;
    color: #00E4FF !important;
    box-shadow: 0 4px 12px rgba(0, 228, 255, 0.3) !important;
}

/* ============================================================================
   6. SECTION CARDS & CONTAINERS
   ============================================================================ */

.section-card,
.form-card {
    background: rgba(42, 45, 87, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 12px !important;
    padding: 1.5rem !important;
    margin-bottom: 1.5rem !important;
    transition: all 0.25s ease-in-out !important;
}

.section-card:hover,
.form-card:hover {
    border-color: rgba(0, 228, 255, 0.2) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.section-header {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    margin-bottom: 1.5rem !important;
    padding-bottom: 1rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.section-header h3 {
    font-size: 20px !important;
    font-weight: 600 !important;
    color: #FFFFFF !important;
    margin: 0 !important;
}

.section-header::before {
    content: '' !important;
    width: 4px !important;
    height: 24px !important;
    background: linear-gradient(135deg, #00E4FF, #667eea) !important;
    border-radius: 2px !important;
}

/* ============================================================================
   7. TABLES & DATA DISPLAY
   ============================================================================ */

table {
    width: 100% !important;
    border-collapse: collapse !important;
    background: rgba(31, 31, 58, 0.6) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

table th {
    background: rgba(0, 228, 255, 0.1) !important;
    color: #FFFFFF !important;
    font-weight: 600 !important;
    padding: 1rem !important;
    text-align: left !important;
    font-size: 13px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

table td {
    padding: 1rem !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    font-size: 14px !important;
}

table tr:hover {
    background: rgba(0, 228, 255, 0.05) !important;
}

/* ============================================================================
   8. HELPER TEXT & DESCRIPTIONS
   ============================================================================ */

.form-help,
.help-text {
    display: block !important;
    margin-top: 0.5rem !important;
    font-size: 12px !important;
    color: rgba(255, 255, 255, 0.6) !important;
    line-height: 1.4 !important;
}

/* ============================================================================
   9. RESPONSIVE IMPROVEMENTS
   ============================================================================ */

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .dashboard-tabs-grid {
        grid-template-columns: 1fr !important;
    }
    
    .dashboard-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .user-info {
        width: 100% !important;
        justify-content: flex-start !important;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="url"],
    select,
    textarea {
        max-width: 100% !important;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 1rem !important;
    }
    
    .section-card,
    .form-card {
        padding: 1rem !important;
    }
    
    .btn {
        padding: 0.625rem 1.25rem !important;
        font-size: 13px !important;
    }
}

/* ============================================================================
   10. ACCESSIBILITY & SECURITY IMPROVEMENTS
   ============================================================================ */

/* Focus indicators for keyboard navigation */
*:focus-visible {
    outline: 2px solid #00E4FF !important;
    outline-offset: 2px !important;
}

/* Prevent text selection on UI elements */
.btn,
.contact-btn,
.tab-card-btn {
    user-select: none !important;
    -webkit-user-select: none !important;
}

/* Security: Prevent clickjacking */
body {
    position: relative !important;
}

/* Security: Content Security Policy helpers */
img {
    max-width: 100% !important;
    height: auto !important;
}

/* ============================================================================
   11. LOADING STATES & ANIMATIONS
   ============================================================================ */

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

.tab-content {
    animation: fadeIn 0.3s ease-out !important;
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid rgba(0, 228, 255, 0.2) !important;
    border-top: 3px solid #00E4FF !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    animation: spin 0.8s linear infinite !important;
}

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

/* ============================================================================
   12. SCROLLBAR STYLING (Modern & Consistent)
   ============================================================================ */

::-webkit-scrollbar {
    width: 10px !important;
    height: 10px !important;
}

::-webkit-scrollbar-track {
    background: rgba(31, 31, 58, 0.5) !important;
    border-radius: 5px !important;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 228, 255, 0.3) !important;
    border-radius: 5px !important;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 228, 255, 0.5) !important;
}

/* ============================================================================
   13. REMOVE UNNECESSARY STYLES & OPTIMIZE
   ============================================================================ */

/* Remove any duplicate or conflicting styles */
.contact-menu {
    /* All styles consolidated above - no duplicates */
}

/* Ensure no white backgrounds leak through */
.contact-dropdown * {
    background-color: transparent !important;
}

.contact-dropdown .contact-menu {
    background: #1F1F3A !important; /* Explicit dark background */
}

/* ============================================================================
   14. PRINT STYLES (Security: Hide sensitive info)
   ============================================================================ */

@media print {
    .contact-dropdown,
    .user-info,
    .btn,
    .tab-card-btn {
        display: none !important;
    }
}
