/* Custom CSS for GiftWish */

/* Theme variables */
:root {
  --primary-color: #7c3aed;
  --primary-hover: #6d28d9;
  --secondary-color: #e5e7eb;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --background: #f9fafb;
  --card-background: #ffffff;
  --border-color: #e5e7eb;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
}

/* Dark theme */
.dark {
  --primary-color: #8b5cf6;
  --primary-hover: #7c3aed;
  --secondary-color: #374151;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --background: #111827;
  --card-background: #1f2937;
  --border-color: #374151;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
}

/* Base styles */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Fix white text in inline elements */
p, span, div, label, a, strong, em, small {
  color: inherit;
}

/* Убираем подчеркивание у всех ссылок полностью */
a, a:link, a:visited, a:hover, a:focus, a:active {
  text-decoration: none !important;
  text-decoration-line: none !important;
  text-decoration-style: none !important;
  text-decoration-color: transparent !important;
  text-underline-offset: 0 !important;
  text-decoration-thickness: 0 !important;
}

/* Убираем подчеркивание для всех возможных псевдоклассов */
a:any-link {
  text-decoration: none !important;
}

/* Глобальное отключение подчеркиваний для всех элементов */
* {
  text-decoration: none !important;
}

/* Принудительное отключение подчеркиваний для всех ссылок */
a, a:link, a:visited, a:hover, a:active, a:focus,
.nav-link, .relative a, .card a, .button a, .btn a {
  text-decoration: none !important;
  text-decoration-line: none !important;
  text-decoration-style: none !important;
  text-decoration-color: transparent !important;
  text-underline-offset: 0 !important;
  text-decoration-thickness: 0 !important;
  -webkit-text-decoration: none !important;
  -moz-text-decoration: none !important;
}

/* Дополнительные стили для кнопок в навигации */
.nav-link, .nav-link:hover, .nav-link:focus, .nav-link:active {
  text-decoration: none !important;
}

/* Фиксируем стили для Tailwind классов */
.text-white, .text-white:hover, .text-white:focus, .text-white:active {
  color: white !important;
}

/* Кнопки с классами bg-purple */
.bg-purple-600, .bg-purple-600:hover, .bg-purple-600:focus, .bg-purple-600:active {
  color: white !important;
}

.bg-purple-700, .bg-purple-700:hover, .bg-purple-700:focus, .bg-purple-700:active {
  color: white !important;
}

/* Принудительное исправление цвета текста кнопок */
button, .btn, .button, 
button:hover, .btn:hover, .button:hover,
button:focus, .btn:focus, .button:focus,
button:active, .btn:active, .button:active,
.bg-purple-600 *, .bg-purple-700 *,
.btn-primary *, .btn-secondary * {
  color: inherit !important;
  text-decoration: none !important;
}

/* Специальные стили для белого текста на фиолетовых кнопках */
.bg-purple-600, .bg-purple-600 *,
.bg-purple-700, .bg-purple-700 *,
.btn-primary, .btn-primary * {
  color: white !important;
}

/* Убираем все возможные подчеркивания */
.no-underline, .no-underline:hover, .no-underline:focus, .no-underline:active {
  text-decoration: none !important;
}

/* Select2 стили для интеграции с Tailwind CSS */
.select2-container {
  width: 100% !important;
  font-size: 0.875rem;
  z-index: 9999;
}

.select2-container--default .select2-selection--single {
  background-color: white !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  height: 42px !important;
  padding: 8px 12px !important;
  color: #111827 !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1) !important;
  outline: none !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #111827 !important;
  line-height: 24px !important;
  padding-left: 0 !important;
  padding-right: 20px !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #6b7280 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 40px !important;
  right: 8px !important;
  top: 1px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: #6b7280 transparent transparent transparent !important;
  border-style: solid !important;
  border-width: 5px 4px 0 4px !important;
}

.select2-dropdown {
  background-color: white !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
  margin-top: 4px !important;
}

.select2-container--default .select2-search--dropdown {
  padding: 8px !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  background-color: white !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  color: #111827 !important;
  font-size: 0.875rem !important;
  padding: 8px 12px !important;
  width: 100% !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1) !important;
  outline: none !important;
}

.select2-results {
  max-height: 200px !important;
}

.select2-container--default .select2-results__option {
  color: #111827 !important;
  background-color: white !important;
  padding: 8px 12px !important;
  font-size: 0.875rem !important;
  cursor: pointer !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #7c3aed !important;
  color: white !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
  background-color: #e5e7eb !important;
  color: #111827 !important;
}

.select2-container--default .select2-results__option[aria-selected=true].select2-results__option--highlighted {
  background-color: #7c3aed !important;
  color: white !important;
}

/* Темная тема для Select2 */
.dark .select2-container--default .select2-selection--single {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
  color: #f9fafb !important;
}

.dark .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #f9fafb !important;
}

.dark .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #9ca3af !important;
}

.dark .select2-dropdown {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
}

.dark .select2-container--default .select2-search--dropdown .select2-search__field {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
  color: #f9fafb !important;
}

.dark .select2-container--default .select2-results__option {
  background-color: #1f2937 !important;
  color: #f9fafb !important;
}

.dark .select2-container--default .select2-results__option[aria-selected=true] {
  background-color: #374151 !important;
  color: #f9fafb !important;
}

a {
  color: var(--primary-color);
}

a:hover, a:focus {
  color: var(--primary-hover);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--secondary-color);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

/* Animation classes */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

.slide-up {
  animation: slideUp 0.3s ease-out;
}

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

/* Card hover effects */
.card-hover {
  transition: all 0.3s ease;
}

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

/* Custom button styles */
.btn-primary {
  background-color: var(--primary-color);
  color: white !important;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: white !important;
  transform: translateY(-1px);
}

.btn-primary:focus, .btn-primary:active {
  color: white !important;
}

.btn-primary a, .btn-primary a:hover, .btn-primary a:focus, .btn-primary a:active {
  color: white !important;
  text-decoration: none !important;
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: var(--border-color);
  color: var(--text-primary) !important;
  transform: translateY(-1px);
}

.btn-secondary:focus, .btn-secondary:active {
  color: var(--text-primary) !important;
}

.btn-secondary a, .btn-secondary a:hover, .btn-secondary a:focus, .btn-secondary a:active {
  color: var(--text-primary) !important;
  text-decoration: none !important;
}

/* Custom input styles */
.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background-color: var(--card-background);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* Priority badges */
.priority-high {
  background-color: #fee2e2;
  color: #dc2626;
}

.priority-medium {
  background-color: #fef3c7;
  color: #d97706;
}

.priority-low {
  background-color: #dcfce7;
  color: #16a34a;
}

/* Gift status badges */
.status-planned {
  background-color: #dbeafe;
  color: #2563eb;
}

.status-given {
  background-color: #d1fae5;
  color: #059669;
}

.status-received {
  background-color: #f3e8ff;
  color: #7c3aed;
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--secondary-color);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive grid improvements */
@media (max-width: 768px) {
  .mobile-stack {
    flex-direction: column;
  }
  
  .mobile-full {
    width: 100%;
  }
  
  .mobile-hidden {
    display: none;
  }
}

/* Custom tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Button text color fixes - ensure text visibility on hover */
button, .btn, input[type="submit"], input[type="button"] {
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Dark buttons keep white text always */
.bg-purple-600, .bg-purple-700, .bg-blue-600, .bg-blue-700, 
.bg-indigo-600, .bg-indigo-700, .bg-green-600, .bg-green-700,
.bg-red-600, .bg-red-700 {
  color: white !important;
}

.bg-purple-600:hover, .bg-purple-700:hover, .bg-blue-600:hover, .bg-blue-700:hover,
.bg-indigo-600:hover, .bg-indigo-700:hover, .bg-green-600:hover, .bg-green-700:hover,
.bg-red-600:hover, .bg-red-700:hover,
.hover\\:bg-purple-700, .hover\\:bg-blue-700, .hover\\:bg-indigo-700, 
.hover\\:bg-green-700, .hover\\:bg-red-700 {
  color: white !important;
}

/* Light buttons keep dark text always */
.bg-gray-100, .bg-gray-200, .bg-white, .bg-gray-50 {
  color: #374151 !important;
}

.bg-gray-100:hover, .bg-gray-200:hover, .bg-white:hover, .bg-gray-50:hover,
.hover\\:bg-gray-200, .hover\\:bg-gray-100 {
  color: #374151 !important;
}

/* Specific text color overrides */
.text-white, .text-white:hover {
  color: white !important;
}

.text-gray-700, .text-gray-700:hover, .text-gray-900, .text-gray-900:hover {
  color: #374151 !important;
}

/* Additional override for stubborn underlines */
* {
  text-decoration: none !important;
}

/* Restore necessary underlines for accessibility */
.underline {
  text-decoration: underline !important;
}

/* Force remove underlines from all navigation and interactive elements */
nav a, .nav a, header a, button, .btn {
  text-decoration: none !important;
}

/* Modal backdrop */
.modal-backdrop {
  backdrop-filter: blur(2px);
  background-color: rgba(0, 0, 0, 0.5);
}

/* Gift item animations */
.gift-item {
  transition: all 0.3s ease;
}

.gift-item:hover {
  background-color: var(--secondary-color);
}

.gift-item.completed {
  opacity: 0.7;
  background-color: var(--secondary-color);
}

/* Filter animations */
.filter-slide {
  transition: all 0.3s ease;
  transform: translateX(0);
}

.filter-slide.hidden {
  transform: translateX(-100%);
  opacity: 0;
}

/* Progress bars */
.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--secondary-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
}

/* Category colors */
.category-electronics { background-color: #dbeafe; color: #2563eb; }
.category-books { background-color: #fef3c7; color: #d97706; }
.category-clothing { background-color: #f3e8ff; color: #7c3aed; }
.category-jewelry { background-color: #fce7f3; color: #db2777; }
.category-sports { background-color: #dcfce7; color: #16a34a; }
.category-home { background-color: #fed7d7; color: #e53e3e; }
.category-beauty { background-color: #fbb6ce; color: #be185d; }
.category-toys { background-color: #bfdbfe; color: #1d4ed8; }
.category-food { background-color: #fde68a; color: #d97706; }
.category-experiences { background-color: #c7d2fe; color: #4338ca; }

/* Relationship colors */
.relation-parent { background-color: #dbeafe; color: #2563eb; }
.relation-sibling { background-color: #dcfce7; color: #16a34a; }
.relation-spouse { background-color: #fce7f3; color: #db2777; }
.relation-child { background-color: #fef3c7; color: #d97706; }
.relation-grandparent { background-color: #f3e8ff; color: #7c3aed; }
.relation-relative { background-color: #fed7d7; color: #e53e3e; }
.relation-friend { background-color: #c7d2fe; color: #4338ca; }

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .card-hover {
    box-shadow: none !important;
  }
}

/* Select2 z-index fixes for mobile menu */
.select2-container {
    z-index: 50 !important;
}

.select2-dropdown {
    z-index: 51 !important;
}

/* Mobile navigation z-index - должен быть выше Select2 */
.mobile-nav,
.fixed.bottom-0.left-0.right-0 {
    z-index: 9999 !important;
}

/* Header и navigation z-index */
nav.bg-white,
header {
    z-index: 9998 !important;
}

/* Modal z-index - должны быть ниже мобильного меню на 5 пунктов */
[id*="modal"].fixed,
.modal-backdrop {
    z-index: 9994 !important;
}

/* Modal positioning for mobile - оставляем место для мобильного меню */
@media (max-width: 768px) {
    [id*="modal"].fixed {
        bottom: 85px !important; /* Высота мобильного меню + отступ */
        top: 20px !important;
        height: calc(100vh - 105px) !important;
    }
    
    [id*="modal"].fixed > div {
        max-height: calc(100vh - 125px) !important;
        overflow-y: auto !important;
    }
    
    /* Вертикальное расположение кнопок в модальных окнах */
    [id*="modal"] .flex.gap-3,
    [id*="modal"] .flex.gap-4,
    [id*="modal"] .flex.space-x-3,
    [id*="modal"] .flex.space-x-4 {
        flex-direction: column !important;
        gap: 0.75rem !important;
        space-x: 0 !important;
    }
    
    /* Кнопки на всю ширину в модальных окнах */
    [id*="modal"] button,
    [id*="modal"] .btn {
        width: 100% !important;
        justify-content: center !important;
        min-height: 44px !important; /* Удобный размер для касания */
    }
}