/* ============================================
   PAKSURF THEME SYSTEM
   Light Mode (default) & Dark Mode
   ============================================ */

/* CSS Variables for Light Mode (default) */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-card: #ffffff;
    --bg-hover: #f9fafb;
    --bg-input: #ffffff;
    
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-inverse: #ffffff;
    
    --border-primary: #e5e7eb;
    --border-secondary: #f3f4f6;
    --border-focus: #4f46e5;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* CSS Variables for Dark Mode */
html.dark {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --bg-input: #0f172a;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-inverse: #0f172a;
    
    --border-primary: #334155;
    --border-secondary: #1e293b;
    --border-focus: #6366f1;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Smooth transition when switching themes */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color 0.3s ease, 
                color 0.3s ease, 
                border-color 0.3s ease,
                box-shadow 0.3s ease !important;
}

/* ============================================
   DARK MODE OVERRIDES
   These override common Tailwind classes
   ============================================ */

/* Body & Main Backgrounds */
html.dark body {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

/* White backgrounds → Dark */
html.dark .bg-white {
    background-color: var(--bg-card) !important;
}

html.dark .bg-gray-50 {
    background-color: var(--bg-secondary) !important;
}

html.dark .bg-gray-100 {
    background-color: var(--bg-tertiary) !important;
}

html.dark .bg-bg-light {
    background-color: var(--bg-secondary) !important;
}

/* Text colors */
html.dark .text-text-dark,
html.dark .text-gray-900 {
    color: var(--text-primary) !important;
}

html.dark .text-gray-800 {
    color: var(--text-primary) !important;
}

html.dark .text-gray-700 {
    color: var(--text-secondary) !important;
}

html.dark .text-text-gray,
html.dark .text-gray-600 {
    color: var(--text-secondary) !important;
}

html.dark .text-gray-500 {
    color: var(--text-muted) !important;
}

html.dark .text-gray-400 {
    color: var(--text-muted) !important;
}

/* Border colors */
html.dark .border-gray-100 {
    border-color: var(--border-secondary) !important;
}

html.dark .border-gray-200 {
    border-color: var(--border-primary) !important;
}

html.dark .border-gray-300 {
    border-color: var(--border-primary) !important;
}

/* Hover states */
html.dark .hover\:bg-gray-50:hover {
    background-color: var(--bg-hover) !important;
}

html.dark .hover\:bg-gray-100:hover {
    background-color: var(--bg-tertiary) !important;
}

html.dark .hover\:bg-gray-200:hover {
    background-color: var(--bg-tertiary) !important;
}

/* Input fields */
html.dark input,
html.dark select,
html.dark textarea {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
    color: var(--text-muted) !important;
}

html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
    border-color: var(--border-focus) !important;
    outline: none !important;
}

/* Disabled inputs */
html.dark input:disabled,
html.dark select:disabled,
html.dark textarea:disabled {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-muted) !important;
}

/* Code blocks */
html.dark code {
    background-color: var(--bg-tertiary) !important;
    color: #f472b6 !important;
}

html.dark pre {
    background-color: var(--bg-secondary) !important;
}

/* Specific badge colors - keep vibrant but adjust background */
html.dark .bg-indigo-50 {
    background-color: rgba(99, 102, 241, 0.15) !important;
}

html.dark .bg-indigo-100 {
    background-color: rgba(99, 102, 241, 0.2) !important;
}

html.dark .bg-green-50 {
    background-color: rgba(16, 185, 129, 0.15) !important;
}

html.dark .bg-green-100 {
    background-color: rgba(16, 185, 129, 0.2) !important;
}

html.dark .bg-yellow-50 {
    background-color: rgba(245, 158, 11, 0.15) !important;
}

html.dark .bg-yellow-100 {
    background-color: rgba(245, 158, 11, 0.2) !important;
}

html.dark .bg-red-50 {
    background-color: rgba(239, 68, 68, 0.15) !important;
}

html.dark .bg-red-100 {
    background-color: rgba(239, 68, 68, 0.2) !important;
}

html.dark .bg-blue-50 {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

html.dark .bg-blue-100 {
    background-color: rgba(59, 130, 246, 0.2) !important;
}

html.dark .bg-purple-50 {
    background-color: rgba(168, 85, 247, 0.15) !important;
}

html.dark .bg-purple-100 {
    background-color: rgba(168, 85, 247, 0.2) !important;
}

html.dark .bg-orange-50 {
    background-color: rgba(249, 115, 22, 0.15) !important;
}

html.dark .bg-orange-100 {
    background-color: rgba(249, 115, 22, 0.2) !important;
}

/* Gradient backgrounds - darken slightly */
html.dark .bg-gradient-to-br.from-indigo-50 {
    background-image: linear-gradient(to bottom right, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1)) !important;
}

/* Table rows */
html.dark table tbody tr:hover {
    background-color: var(--bg-hover) !important;
}

html.dark table thead {
    background-color: var(--bg-secondary) !important;
}

/* Sidebar specific */
html.dark aside {
    background-color: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Header specific */
html.dark header {
    background-color: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Modal backdrop */
html.dark .modal {
    background-color: rgba(0, 0, 0, 0.7) !important;
}

/* Scrollbar styling for dark mode */
html.dark ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html.dark ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

html.dark ::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

html.dark ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Theme toggle button */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Theme dropdown */
.theme-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 100;
    overflow: hidden;
}

.theme-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.theme-dropdown-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.theme-dropdown-item.active {
    background-color: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

html.dark .theme-dropdown-item.active {
    color: #818cf8;
}

/* Images - slightly dim in dark mode */
html.dark img:not(.no-dark-mode) {
    opacity: 0.9;
}

/* Footer */
html.dark footer {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
}

/* Navigation backdrop blur */
html.dark nav.bg-white\/80 {
    background-color: rgba(15, 23, 42, 0.8) !important;
    border-color: var(--border-primary) !important;
}