/**
 * OneTimeLogin - Main Custom Styles
 * Light/Dark theme support and custom components
 */

/* ============================================
   CSS Variables for Theme Colors
   ============================================ */
:root {
    /* Dark mode (default) */
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-card: #1f2937;
    --bg-input: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-color: #374151;
    --border-light: #4b5563;
}

html.light {
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --border-light: #d1d5db;
}

/* ============================================
   Light Mode - Body & Main Containers
   ============================================ */
html.light body {
    background-color: #f3f4f6 !important;
    color: #111827 !important;
}

html.light main {
    background-color: #f3f4f6 !important;
}

/* ============================================
   Light Mode - Background Colors
   ============================================ */
html.light .bg-gray-950 {
    background-color: #ffffff !important;
}

html.light .bg-gray-900 {
    background-color: #ffffff !important;
}

html.light .bg-gray-800 {
    background-color: #f9fafb !important;
}

html.light .bg-gray-800\/50,
html.light .bg-gray-800\/30,
html.light .bg-gray-800\/20,
html.light .bg-gray-800\/10 {
    background-color: rgba(249, 250, 251, 0.9) !important;
}

html.light .bg-gray-700 {
    background-color: #f3f4f6 !important;
}

html.light .bg-gray-700\/50,
html.light .bg-gray-700\/30,
html.light .bg-gray-700\/20 {
    background-color: rgba(243, 244, 246, 0.9) !important;
}

html.light .bg-gray-600 {
    background-color: #e5e7eb !important;
}

html.light .bg-black\/80,
html.light .bg-black\/60,
html.light .bg-black\/50 {
    background-color: rgba(0, 0, 0, 0.5) !important;
}

/* ============================================
   Light Mode - Text Colors
   ============================================ */
html.light .text-white {
    color: #111827 !important;
}

html.light .text-gray-50 {
    color: #111827 !important;
}

html.light .text-gray-100 {
    color: #1f2937 !important;
}

html.light .text-gray-200 {
    color: #374151 !important;
}

html.light .text-gray-300 {
    color: #4b5563 !important;
}

html.light .text-gray-400 {
    color: #6b7280 !important;
}

html.light .text-gray-500 {
    color: #9ca3af !important;
}

/* ============================================
   Light Mode - Border Colors
   ============================================ */
html.light .border-gray-900 {
    border-color: #e5e7eb !important;
}

html.light .border-gray-800 {
    border-color: #d1d5db !important;
}

html.light .border-gray-700 {
    border-color: #e5e7eb !important;
}

html.light .border-gray-700\/50,
html.light .border-gray-700\/30 {
    border-color: rgba(229, 231, 235, 0.8) !important;
}

html.light .border-gray-600 {
    border-color: #d1d5db !important;
}

html.light .divide-gray-700 > * + * {
    border-color: #e5e7eb !important;
}

html.light .divide-gray-800 > * + * {
    border-color: #d1d5db !important;
}

/* ============================================
   Light Mode - Form Elements
   ============================================ */
html.light input,
html.light select,
html.light textarea {
    background-color: #ffffff !important;
    border-color: #d1d5db !important;
    color: #111827 !important;
}

html.light input::placeholder,
html.light textarea::placeholder {
    color: #9ca3af !important;
}

html.light input:focus,
html.light select:focus,
html.light textarea:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

html.light input:disabled,
html.light select:disabled,
html.light textarea:disabled {
    background-color: #f3f4f6 !important;
    color: #9ca3af !important;
}

html.light input[type="checkbox"],
html.light input[type="radio"] {
    background-color: #ffffff !important;
    border-color: #d1d5db !important;
}

html.light input[type="checkbox"]:checked,
html.light input[type="radio"]:checked {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

/* Light mode for specific input classes */
html.light .bg-gray-700 input,
html.light .bg-gray-700 select,
html.light .bg-gray-700 textarea,
html.light input.bg-gray-700,
html.light select.bg-gray-700,
html.light textarea.bg-gray-700 {
    background-color: #ffffff !important;
    border-color: #d1d5db !important;
    color: #111827 !important;
}

/* ============================================
   Light Mode - Buttons (Secondary/Gray)
   ============================================ */
html.light .bg-gray-700:not(input):not(select):not(textarea) {
    background-color: #e5e7eb !important;
}

html.light .bg-gray-600:not(input):not(select):not(textarea) {
    background-color: #d1d5db !important;
}

/* ============================================
   Light Mode - Hover States
   ============================================ */
html.light .hover\:bg-gray-900:hover {
    background-color: #f3f4f6 !important;
}

html.light .hover\:bg-gray-800:hover {
    background-color: #e5e7eb !important;
}

html.light .hover\:bg-gray-700:hover {
    background-color: #d1d5db !important;
}

html.light .hover\:bg-gray-600:hover {
    background-color: #d1d5db !important;
}

html.light .hover\:text-white:hover {
    color: #111827 !important;
}

html.light .hover\:text-gray-100:hover {
    color: #1f2937 !important;
}

html.light .hover\:border-gray-600:hover {
    border-color: #9ca3af !important;
}

/* ============================================
   Light Mode - Cards and Containers
   ============================================ */
html.light .rounded-xl.bg-gray-800,
html.light .rounded-lg.bg-gray-800,
html.light .rounded-2xl.bg-gray-800 {
    background-color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

html.light .rounded-xl.bg-gray-900,
html.light .rounded-lg.bg-gray-900,
html.light .rounded-2xl.bg-gray-900 {
    background-color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* ============================================
   Light Mode - Modals and Dialogs
   ============================================ */
html.light .modal,
html.light [role="dialog"] > div > div,
html.light .fixed.inset-0 > div > div {
    background-color: #ffffff !important;
}

html.light [role="dialog"] .bg-gray-800 {
    background-color: #ffffff !important;
}

/* ============================================
   Light Mode - Tables
   ============================================ */
html.light table {
    background-color: #ffffff !important;
}

html.light thead {
    background-color: #f9fafb !important;
}

html.light th {
    background-color: #f9fafb !important;
    color: #374151 !important;
    border-color: #e5e7eb !important;
}

html.light td {
    border-color: #e5e7eb !important;
    color: #374151 !important;
}

html.light tbody tr:hover {
    background-color: #f3f4f6 !important;
}

html.light .even\:bg-gray-800:nth-child(even) {
    background-color: #f9fafb !important;
}

html.light .odd\:bg-gray-900:nth-child(odd) {
    background-color: #ffffff !important;
}

/* ============================================
   Light Mode - Navigation & Sidebar
   ============================================ */
html.light nav {
    background-color: #ffffff !important;
    border-color: #e5e7eb !important;
}

html.light aside {
    background-color: #ffffff !important;
    border-color: #e5e7eb !important;
}

html.light .nav-item,
html.light .sidebar-item {
    color: #374151 !important;
}

html.light .nav-item:hover,
html.light .sidebar-item:hover {
    background-color: #f3f4f6 !important;
}

html.light .nav-item.active,
html.light .sidebar-item.active {
    background-color: #eff6ff !important;
    color: #2563eb !important;
}

/* ============================================
   Light Mode - Footer
   ============================================ */
html.light footer {
    background-color: #f9fafb !important;
    border-color: #e5e7eb !important;
}

html.light footer a {
    color: #6b7280 !important;
}

html.light footer a:hover {
    color: #111827 !important;
}

/* ============================================
   Light Mode - Badges and Tags
   ============================================ */
html.light .bg-gray-700.rounded-full,
html.light .bg-gray-800.rounded-full {
    background-color: #e5e7eb !important;
    color: #374151 !important;
}

/* ============================================
   Light Mode - Code Blocks
   ============================================ */
html.light pre,
html.light code {
    background-color: #f3f4f6 !important;
    color: #1f2937 !important;
}

html.light .bg-gray-900 pre,
html.light .bg-gray-900 code {
    background-color: #e5e7eb !important;
}

/* ============================================
   Light Mode - Shadows
   ============================================ */
html.light .shadow-lg,
html.light .shadow-xl,
html.light .shadow-2xl {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

/* ============================================
   Light Mode - Ring Colors
   ============================================ */
html.light .ring-gray-700 {
    --tw-ring-color: #d1d5db !important;
}

html.light .ring-gray-800 {
    --tw-ring-color: #e5e7eb !important;
}

/* ============================================
   Light Mode - Scrollbar
   ============================================ */
html.light ::-webkit-scrollbar-track {
    background: #f3f4f6;
}

html.light ::-webkit-scrollbar-thumb {
    background: #d1d5db;
}

html.light ::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ============================================
   Light Mode - Placeholder Images / Empty States
   ============================================ */
html.light .bg-gradient-to-br.from-gray-800 {
    background: linear-gradient(to bottom right, #e5e7eb, #d1d5db) !important;
}

html.light .bg-gradient-to-r.from-gray-800 {
    background: linear-gradient(to right, #e5e7eb, #d1d5db) !important;
}

/* ============================================
   Dark Mode - Custom Scrollbar (Default)
   ============================================ */
::-webkit-scrollbar {
    width: 0.5rem;
    height: 0.5rem;
}

::-webkit-scrollbar-track {
    background: rgb(17, 24, 39);
}

::-webkit-scrollbar-thumb {
    background: rgb(75, 85, 99);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgb(107, 114, 128);
}

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

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

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

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

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

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.4s ease-out;
}

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

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

.animate-pulse-slow {
    animation: pulse 2s ease-in-out infinite;
}

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

/* ============================================
   Glass Effect
   ============================================ */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

html.light .glass {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ============================================
   Gradient Text
   ============================================ */
.gradient-text {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.toast-success {
    background-color: #10b981;
    color: white;
}

.toast-error {
    background-color: #ef4444;
    color: white;
}

.toast-info {
    background-color: #3b82f6;
    color: white;
}

.toast-warning {
    background-color: #f59e0b;
    color: white;
}

/* ============================================
   Toggle Switch Component
   ============================================ */
.toggle-switch {
    position: relative;
    display: inline-flex;
    height: 1.5rem;
    width: 2.75rem;
    align-items: center;
    border-radius: 9999px;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    outline: none;
}

.toggle-switch.enabled {
    background-color: #3b82f6;
}

.toggle-switch.disabled {
    background-color: #4b5563;
}

html.light .toggle-switch.disabled {
    background-color: #d1d5db;
}

.toggle-switch:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    height: 1rem;
    width: 1rem;
    border-radius: 9999px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    left: 0.25rem;
}

.toggle-switch.enabled::after {
    transform: translateX(1.25rem);
}

/* ============================================
   Custom Card Styles
   ============================================ */
.card {
    background-color: var(--bg-card);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}

.card-hover {
    transition: transform 0.2s, box-shadow 0.2s;
}

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

html.light .card-hover:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Status Indicators
   ============================================ */
.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
}

.status-online {
    background-color: #10b981;
}

.status-offline {
    background-color: #6b7280;
}

.status-warning {
    background-color: #f59e0b;
}

.status-error {
    background-color: #ef4444;
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 9999px;
    animation: spin 0.75s linear infinite;
}

/* ============================================
   Utility Classes
   ============================================ */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
