/* SnowUI Theme - Custom Component Library */

/* ============================================
   CORE STYLES
   ============================================ */

* {
    font-family: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    direction: rtl;
    text-align: right;
}

/* Force English numerals (0-9) instead of Arabic-Indic numerals (٠-٩) */
body, * {
    font-variant-numeric: normal;
    -webkit-font-feature-settings: normal;
    font-feature-settings: normal;
}

/* Ensure numbers in specific contexts use English numerals */
[dir="ltr"], .number, code, .font-mono {
    font-variant-numeric: normal;
    -webkit-font-feature-settings: normal;
    font-feature-settings: normal;
}

/* ============================================
   CARD COMPONENT
   ============================================ */

.snow-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.snow-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* ============================================
   BUTTON COMPONENT - Enhanced Modern Design
   ============================================ */

.snow-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    border-radius: 0.625rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    outline: none;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.snow-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 50%);
    pointer-events: none;
}

.snow-button:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

.snow-button:active {
    transform: scale(0.98);
}

/* Button Variants */
.snow-button-primary {
    background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.35);
}

.snow-button-primary:hover {
    background: linear-gradient(135deg, #5457DC 0%, #4338CA 100%);
    box-shadow: 0 6px 20px 0 rgba(79, 70, 229, 0.45);
    transform: translateY(-2px);
}

.snow-button-secondary {
    background: linear-gradient(135deg, #A855F7 0%, #9333EA 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(147, 51, 234, 0.35);
}

.snow-button-secondary:hover {
    background: linear-gradient(135deg, #9333EA 0%, #7E22CE 100%);
    box-shadow: 0 6px 20px 0 rgba(147, 51, 234, 0.45);
    transform: translateY(-2px);
}

.snow-button-success {
    background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(22, 163, 74, 0.35);
}

.snow-button-success:hover {
    background: linear-gradient(135deg, #16A34A 0%, #15803D 100%);
    box-shadow: 0 6px 20px 0 rgba(22, 163, 74, 0.45);
    transform: translateY(-2px);
}

.snow-button-ghost {
    background: transparent;
    color: #4B5563;
    border: 1.5px solid #E5E7EB;
    box-shadow: none;
}

.snow-button-ghost::before {
    display: none;
}

.snow-button-ghost:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
    color: #374151;
    transform: translateY(-1px);
}

.snow-button-danger {
    background: linear-gradient(135deg, #F87171 0%, #EF4444 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.35);
}

.snow-button-danger:hover {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    box-shadow: 0 6px 20px 0 rgba(239, 68, 68, 0.45);
    transform: translateY(-2px);
}

.snow-button-warning {
    background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
    color: #78350F;
    box-shadow: 0 4px 14px 0 rgba(245, 158, 11, 0.35);
}

.snow-button-warning:hover {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    box-shadow: 0 6px 20px 0 rgba(245, 158, 11, 0.45);
    transform: translateY(-2px);
}

.snow-button-info {
    background: linear-gradient(135deg, #60A5FA 0%, #3B82F6 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.35);
}

.snow-button-info:hover {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    box-shadow: 0 6px 20px 0 rgba(59, 130, 246, 0.45);
    transform: translateY(-2px);
}

/* Button with Icon Only */
.snow-button-icon {
    padding: 0.625rem;
    width: 2.5rem;
    height: 2.5rem;
}

.snow-button-icon.snow-button-sm {
    padding: 0.5rem;
    width: 2rem;
    height: 2rem;
}

/* Button Sizes */
.snow-button-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    border-radius: 0.5rem;
}

.snow-button-md {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

.snow-button-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    border-radius: 0.75rem;
}

.snow-button-xl {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    border-radius: 0.875rem;
}

/* Button Loading State */
.snow-button-loading {
    pointer-events: none;
    opacity: 0.75;
}

.snow-button-loading .snow-button-text {
    visibility: hidden;
}

.snow-button-loading::after {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ============================================
   BADGE COMPONENT
   ============================================ */

.snow-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    border-radius: 9999px;
    white-space: nowrap;
}

/* Badge Variants */
.snow-badge-default {
    background: #F3F4F6;
    color: #374151;
}

.snow-badge-primary {
    background: #EEF2FF;
    color: #4F46E5;
}

.snow-badge-secondary {
    background: #FAF5FF;
    color: #9333EA;
}

.snow-badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.snow-badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.snow-badge-error {
    background: #FEE2E2;
    color: #991B1B;
}

.snow-badge-info {
    background: #DBEAFE;
    color: #1E40AF;
}

.snow-badge-gray {
    background: #F3F4F6;
    color: #6B7280;
}

/* Badge Sizes */
.snow-badge-sm {
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
}

.snow-badge-md {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.snow-badge-lg {
    padding: 0.375rem 1rem;
    font-size: 0.9375rem;
}

/* ============================================
   DROPDOWN COMPONENT
   ============================================ */

.snow-dropdown {
    position: relative;
    display: inline-block;
}

.snow-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    margin-top: 0.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    border: 1px solid #E5E7EB;
    min-width: 12rem;
    z-index: 50;
    overflow: hidden;
}

.snow-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.2s;
    font-size: 0.9375rem;
}

.snow-dropdown-item:hover {
    background: #F9FAFB;
    color: #4F46E5;
}

.snow-dropdown-item i {
    width: 1.25rem;
    text-align: center;
}

/* ============================================
   AVATAR COMPONENT
   ============================================ */

.snow-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border-radius: 0.75rem;
    background: #4F46E5;
    color: white;
}

.snow-avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.snow-avatar-md {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.875rem;
}

.snow-avatar-lg {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
}

.snow-avatar-xl {
    width: 4rem;
    height: 4rem;
    font-size: 1.25rem;
}

/* ============================================
   ALERT COMPONENT
   ============================================ */

.snow-alert {
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
}

.snow-alert-success {
    background: #D1FAE5;
    color: #065F46;
    border-color: #6EE7B7;
}

.snow-alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #FCA5A5;
}

.snow-alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border-color: #FCD34D;
}

.snow-alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border-color: #93C5FD;
}

/* ============================================
   FORM COMPONENTS
   ============================================ */

.snow-form-group {
    margin-bottom: 1rem;
}

.snow-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.snow-input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #111827;
    background-color: #ffffff;
    background-clip: padding-box;
    border: 1px solid #D1D5DB;
    border-radius: 0.5rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.snow-input:focus {
    color: #111827;
    background-color: #ffffff;
    border-color: #4F46E5;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.snow-input::placeholder {
    color: #9CA3AF;
    opacity: 1;
}

.snow-checkbox {
    width: 1rem;
    height: 1rem;
    margin-left: 0.5rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.25rem;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.snow-checkbox:checked {
    background-color: #4F46E5;
    border-color: #4F46E5;
}

.snow-checkbox:focus {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.snow-help-text {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6B7280;
}

/* ============================================
   FLASH MESSAGES
   ============================================ */

.snow-flash {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.snow-flash-success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
}

.snow-flash-error {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
}

.snow-flash-warning {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
}

.snow-flash-info {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
}

/* ============================================
   DIVIDER
   ============================================ */

.snow-divider {
    border: none;
    border-top: 1px solid #E5E7EB;
    margin: 1.5rem 0;
}

.snow-divider-text {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
}

.snow-divider-text::before,
.snow-divider-text::after {
    content: '';
    flex: 1;
    border-top: 1px solid #E5E7EB;
}

.snow-divider-text span {
    padding: 0 1rem;
    color: #6B7280;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

.animate-slide-down {
    animation: slideDown 0.2s ease-out;
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.snow-spinner {
    display: inline-block;
    color: #4F46E5;
}

.snow-spinner-sm {
    font-size: 1rem;
}

.snow-spinner-md {
    font-size: 1.5rem;
}

.snow-spinner-lg {
    font-size: 2rem;
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #F9FAFB;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

.pointer-events-none {
    pointer-events: none;
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 768px) {
    .snow-card {
        padding: 1rem;
    }

    .snow-dropdown-menu {
        left: auto;
        right: 0;
    }
}

/* ============================================
   TOM SELECT - Searchable Dropdowns RTL
   ============================================ */

/* Base Tom Select Container */
.ts-wrapper {
    direction: rtl;
}

.ts-wrapper.single .ts-control {
    background-color: #ffffff;
    border: 1.5px solid #E5E7EB;
    border-radius: 0.625rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    min-height: 2.75rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.ts-wrapper.single .ts-control:hover {
    border-color: #D1D5DB;
}

.ts-wrapper.focus .ts-control {
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.ts-wrapper .ts-control > input {
    font-size: 0.9375rem;
    color: #111827;
}

.ts-wrapper .ts-control > input::placeholder {
    color: #9CA3AF;
}

/* Dropdown Wrapper */
.ts-dropdown {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.15), 0 4px 12px -2px rgba(0, 0, 0, 0.1);
    margin-top: 0.5rem;
    z-index: 1000;
    overflow: hidden;
}

.ts-dropdown .ts-dropdown-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Options */
.ts-dropdown .option {
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    color: #374151;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 0.125rem;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    color: #4F46E5;
}

.ts-dropdown .option.selected {
    background: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%);
    color: white;
    font-weight: 500;
}

/* Selected Item */
.ts-wrapper .ts-control .item {
    color: #111827;
    font-weight: 500;
}

/* Search Input */
.ts-dropdown .ts-dropdown-content .ts-input-wrap {
    padding: 0.5rem;
}

/* No Results */
.ts-dropdown .no-results {
    padding: 1.5rem;
    text-align: center;
    color: #9CA3AF;
    font-size: 0.875rem;
}

/* Arrow */
.ts-wrapper.single .ts-control::after {
    content: '';
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #9CA3AF;
    transition: transform 0.2s;
}

.ts-wrapper.single.dropdown-active .ts-control::after {
    transform: translateY(-50%) rotate(180deg);
}

/* Multi Select */
.ts-wrapper.multi .ts-control {
    background-color: #ffffff;
    border: 1.5px solid #E5E7EB;
    border-radius: 0.625rem;
    padding: 0.375rem;
    min-height: 2.75rem;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.ts-wrapper.multi .ts-control .item {
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    color: #4F46E5;
    border: none;
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.ts-wrapper.multi .ts-control .item .remove {
    border: none;
    margin-right: 0.5rem;
    margin-left: 0;
}

/* Disabled State */
.ts-wrapper.disabled .ts-control {
    background-color: #F9FAFB;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Plugin: Clear Button */
.ts-wrapper .clear-button {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
    cursor: pointer;
    transition: color 0.15s;
}

.ts-wrapper .clear-button:hover {
    color: #EF4444;
}

/* Plugin: Dropdown Header */
.ts-dropdown .dropdown-header {
    padding: 0.75rem 1rem;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
    font-weight: 600;
    color: #374151;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Optgroup */
.ts-dropdown .optgroup-header {
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: #6B7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: transparent;
}

/* Highlight */
.ts-dropdown .option .highlight {
    background: #FEF3C7;
    border-radius: 0.125rem;
    padding: 0 0.125rem;
}

/* Loading State */
.ts-wrapper.loading .ts-control::before {
    content: '';
    position: absolute;
    left: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid #E5E7EB;
    border-top-color: #4F46E5;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Scrollbar for Dropdown */
.ts-dropdown .ts-dropdown-content::-webkit-scrollbar {
    width: 6px;
}

.ts-dropdown .ts-dropdown-content::-webkit-scrollbar-track {
    background: #F9FAFB;
    border-radius: 3px;
}

.ts-dropdown .ts-dropdown-content::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 3px;
}

.ts-dropdown .ts-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}
