/* ============================================
   COLOR ENHANCEMENTS - Universal Color System
   Enhanced for Light & Dark Modes
   ============================================ */

/* ===== LIGHT MODE ENHANCEMENTS ===== */
body:not(.dark-theme),
html:not(.dark-theme) {
    /* Enhanced Background */
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

/* Improved Text Contrast - Light Mode */
body:not(.dark-theme) p,
html:not(.dark-theme) p {
    color: #475569;
    line-height: 1.7;
}

body:not(.dark-theme) h1,
html:not(.dark-theme) h1 {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body:not(.dark-theme) h2,
html:not(.dark-theme) h2 {
    color: #1e293b;
}

body:not(.dark-theme) h3,
html:not(.dark-theme) h3 {
    color: #334155;
}

/* ===== DARK MODE ENHANCEMENTS ===== */

/* Enhanced Background with Depth */
html.dark-theme body,
body.dark-theme {
    background: linear-gradient(180deg, #0a0f1e 0%, #0f172a 50%, #1e293b 100%);
    color: #f8fafc;
}

/* Improved Text Hierarchy - Dark Mode */
html.dark-theme h1,
body.dark-theme h1 {
    background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

html.dark-theme h2,
body.dark-theme h2 {
    color: #e2e8f0;
}

html.dark-theme h3,
body.dark-theme h3 {
    color: #cbd5e1;
}

html.dark-theme p,
body.dark-theme p {
    color: #94a3b8;
    line-height: 1.75;
}

/* ===== ENHANCED LINKS ===== */
a {
    color: #3b82f6;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

a:hover {
    color: #2563eb;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.3s ease;
}

a:hover::after {
    width: 100%;
}

html.dark-theme a,
body.dark-theme a {
    color: #60a5fa;
}

html.dark-theme a:hover,
body.dark-theme a:hover {
    color: #93c5fd;
}

html.dark-theme a::after,
body.dark-theme a::after {
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
}

/* ===== ENHANCED INPUTS ===== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    padding: 12px 16px;
    color: #1e293b;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 0 20px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

/* Dark Mode Inputs */
html.dark-theme input[type="text"],
html.dark-theme input[type="email"],
html.dark-theme input[type="password"],
html.dark-theme input[type="search"],
html.dark-theme textarea,
html.dark-theme select,
body.dark-theme input[type="text"],
body.dark-theme input[type="email"],
body.dark-theme input[type="password"],
body.dark-theme input[type="search"],
body.dark-theme textarea,
body.dark-theme select {
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid rgba(96, 165, 250, 0.2);
    color: #f8fafc;
}

html.dark-theme input:focus,
html.dark-theme textarea:focus,
html.dark-theme select:focus,
body.dark-theme input:focus,
body.dark-theme textarea:focus,
body.dark-theme select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15), 0 0 25px rgba(96, 165, 250, 0.3);
}

/* ===== ENHANCED BADGES & TAGS ===== */
.badge,
.tag {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.badge-primary,
.tag-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.badge-success,
.tag-success {
    background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.badge-warning,
.tag-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.badge-error,
.tag-error {
    background: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

/* ===== ENHANCED ALERTS ===== */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    border-left: 4px solid;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(20, 184, 166, 0.05) 100%);
    border-left-color: #10b981;
    color: #065f46;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(249, 115, 22, 0.05) 100%);
    border-left-color: #f59e0b;
    color: #92400e;
}

.alert-error {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.1) 0%, rgba(236, 72, 153, 0.05) 100%);
    border-left-color: #f43f5e;
    color: #991b1b;
}

.alert-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-left-color: #3b82f6;
    color: #1e40af;
}

/* Dark Mode Alerts */
html.dark-theme .alert-success,
body.dark-theme .alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(20, 184, 166, 0.1) 100%);
    color: #6ee7b7;
}

html.dark-theme .alert-warning,
body.dark-theme .alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(249, 115, 22, 0.1) 100%);
    color: #fcd34d;
}

html.dark-theme .alert-error,
body.dark-theme .alert-error {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.2) 0%, rgba(236, 72, 153, 0.1) 100%);
    color: #fda4af;
}

html.dark-theme .alert-info,
body.dark-theme .alert-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(139, 92, 246, 0.1) 100%);
    color: #93c5fd;
}

/* ===== ENHANCED CODE BLOCKS ===== */
code {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(139, 92, 246, 0.05) 100%);
    color: #3b82f6;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

html.dark-theme code,
body.dark-theme code {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15) 0%, rgba(167, 139, 250, 0.1) 100%);
    color: #93c5fd;
    border-color: rgba(96, 165, 250, 0.3);
}

pre {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.9) 100%);
    color: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    border: 1px solid rgba(96, 165, 250, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
}

/* ===== ENHANCED TABLES ===== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

thead {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
}

thead th {
    padding: 16px;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

tbody tr {
    background: white;
    transition: all 0.3s ease;
}

tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.5);
}

tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
    transform: scale(1.01);
}

tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    color: #475569;
}

/* Dark Mode Tables */
html.dark-theme table,
body.dark-theme table {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

html.dark-theme tbody tr,
body.dark-theme tbody tr {
    background: rgba(30, 41, 59, 0.5);
}

html.dark-theme tbody tr:nth-child(even),
body.dark-theme tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.5);
}

html.dark-theme tbody tr:hover,
body.dark-theme tbody tr:hover {
    background: rgba(96, 165, 250, 0.1);
}

html.dark-theme tbody td,
body.dark-theme tbody td {
    border-bottom-color: rgba(96, 165, 250, 0.1);
    color: #cbd5e1;
}

/* ===== SCROLLBAR ENHANCEMENTS ===== */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}

/* Dark Mode Scrollbar */
html.dark-theme ::-webkit-scrollbar-track,
body.dark-theme ::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}

html.dark-theme ::-webkit-scrollbar-thumb,
body.dark-theme ::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    border-color: rgba(15, 23, 42, 0.3);
}

/* ===== SELECTION HIGHLIGHT ===== */
::selection {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(139, 92, 246, 0.3) 100%);
    color: #1e293b;
}

html.dark-theme ::selection,
body.dark-theme ::selection {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.4) 0%, rgba(167, 139, 250, 0.4) 100%);
    color: #f8fafc;
}

/* ===== LOADING STATES ===== */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== TRANSITIONS FOR THEME SWITCHING ===== */
.theme-transitioning,
.theme-transitioning * {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
