/* Components CSS - Reusable UI Components */

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-left: 4px solid;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left-color: #10b981;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-warning {
    border-left-color: #f59e0b;
}

.toast-info {
    border-left-color: #3b82f6;
}

.toast-content {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
}

.toast-content i {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.toast-success .toast-content i {
    color: #10b981;
}

.toast-error .toast-content i {
    color: #ef4444;
}

.toast-warning .toast-content i {
    color: #f59e0b;
}

.toast-info .toast-content i {
    color: #3b82f6;
}

.toast-message {
    flex: 1;
    color: #374151;
    font-weight: 500;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: #f3f4f6;
    color: #6b7280;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

.loading-spinner p {
    font-size: 1.125rem;
    font-weight: 500;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    line-height: 1;
    justify-content: center;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, #2563EB, #2563EB);
    color: white;
    border: 1px solid transparent;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #1D4ED8, #1D4ED8);
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border: 1px solid transparent;
}

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
    transform: translateY(-1px);
}

.btn-success {
    background: #10b981;
    color: white;
    border: 1px solid transparent;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
}

.btn-warning {
    background: #f59e0b;
    color: white;
    border: 1px solid transparent;
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
    transform: translateY(-1px);
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: 1px solid transparent;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-outline {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-outline:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
}

.btn-ghost {
    background: transparent;
    color: #374151;
    border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: #f3f4f6;
    color: #111827;
}

.btn-link {
    background: transparent;
    color: #2563EB;
    border: none;
    padding: 4px 8px;
    text-decoration: underline;
}

.btn-link:hover:not(:disabled) {
    color: #1D4ED8;
    text-decoration: none;
}

/* Button Sizes */
.btn-sm {
    padding: 8px 16px;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
}

.btn-xl {
    padding: 20px 40px;
    font-size: 1.125rem;
}

.btn-full {
    width: 100%;
}

/* Form Components */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
   transition: all 0.2s ease;
   background: white;
   color: #374151;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
   outline: none;
   border-color: #2563EB;
   box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
   border-color: #ef4444;
   background: #fef2f2;
}

.form-input.success,
.form-select.success,
.form-textarea.success {
   border-color: #10b981;
   background: #f0fdf4;
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
   background: #f9fafb;
   color: #9ca3af;
   cursor: not-allowed;
}

.form-textarea {
   resize: vertical;
   min-height: 100px;
}

.form-group small {
   display: block;
   margin-top: 4px;
   color: #6b7280;
   font-size: 0.75rem;
}

.field-error {
   color: #ef4444;
   font-size: 0.75rem;
   margin-top: 4px;
   display: block;
}

.checkbox-label {
   display: flex !important;
   align-items: center;
   gap: 8px;
   font-weight: normal !important;
   cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
   width: auto;
   margin: 0;
}

/* Progress Bars */
.progress-bar {
   width: 100%;
   height: 8px;
   background: #f3f4f6;
   border-radius: 4px;
   overflow: hidden;
   position: relative;
}

.progress-fill {
   height: 100%;
   background: linear-gradient(90deg, #2563EB, #2563EB);
   border-radius: 4px;
   transition: width 0.3s ease;
   position: relative;
}

.progress-fill::after {
   content: '';
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background: linear-gradient(
       90deg,
       transparent,
       rgba(255, 255, 255, 0.2),
       transparent
   );
   animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
   0% { transform: translateX(-100%); }
   100% { transform: translateX(100%); }
}

.progress-bar.success .progress-fill {
   background: linear-gradient(90deg, #10b981, #059669);
}

.progress-bar.warning .progress-fill {
   background: linear-gradient(90deg, #f59e0b, #d97706);
}

.progress-bar.danger .progress-fill {
   background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Cards */
.card {
   background: white;
   border-radius: 12px;
   box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
   border: 1px solid #e5e7eb;
   overflow: hidden;
   transition: all 0.3s ease;
}

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

.card-header {
   padding: 20px 24px;
   border-bottom: 1px solid #e5e7eb;
}

.card-body {
   padding: 24px;
}

.card-footer {
   padding: 20px 24px;
   border-top: 1px solid #e5e7eb;
   background: #f9fafb;
}

.card-title {
   font-size: 1.25rem;
   font-weight: 600;
   color: #1f2937;
   margin-bottom: 8px;
}

.card-subtitle {
   color: #6b7280;
   font-size: 0.875rem;
   margin-bottom: 16px;
}

.card-text {
   color: #374151;
   line-height: 1.6;
}

/* Badges */
.badge {
   display: inline-flex;
   align-items: center;
   padding: 4px 8px;
   border-radius: 4px;
   font-size: 0.75rem;
   font-weight: 500;
   line-height: 1;
}

.badge-primary {
   background: #e0e7ff;
   color: #3730a3;
}

.badge-success {
   background: #d1fae5;
   color: #065f46;
}

.badge-warning {
   background: #fef3c7;
   color: #92400e;
}

.badge-danger {
   background: #fee2e2;
   color: #991b1b;
}

.badge-info {
   background: #dbeafe;
   color: #1e40af;
}

.badge-secondary {
   background: #f3f4f6;
   color: #374151;
}

/* Alerts */
.alert {
   padding: 16px 20px;
   border-radius: 8px;
   margin-bottom: 20px;
   display: flex;
   align-items: center;
   gap: 12px;
   font-weight: 500;
   border: 1px solid;
}

.alert-success {
   background: #f0fdf4;
   color: #166534;
   border-color: #bbf7d0;
}

.alert-error {
   background: #fef2f2;
   color: #991b1b;
   border-color: #fecaca;
}

.alert-warning {
   background: #fffbeb;
   color: #92400e;
   border-color: #fed7aa;
}

.alert-info {
   background: #eff6ff;
   color: #1e40af;
   border-color: #bfdbfe;
}

.alert i {
   flex-shrink: 0;
   font-size: 1.25rem;
}

/* Breadcrumbs */
.breadcrumb {
   margin-bottom: 24px;
}

.breadcrumb-list {
   display: flex;
   align-items: center;
   gap: 8px;
   list-style: none;
   margin: 0;
   padding: 0;
}

.breadcrumb-item {
   display: flex;
   align-items: center;
   font-size: 0.875rem;
}

.breadcrumb-item:not(:last-child)::after {
   content: '>';
   margin-left: 8px;
   color: #9ca3af;
}

.breadcrumb-item a {
   color: #2563EB;
   text-decoration: none;
}

.breadcrumb-item a:hover {
   text-decoration: underline;
}

.breadcrumb-item.active span {
   color: #6b7280;
}

/* Tabs */
.tabs {
   margin-bottom: 24px;
}

.tab-list {
   display: flex;
   border-bottom: 1px solid #e5e7eb;
   margin-bottom: 24px;
}

.tab-button {
   background: none;
   border: none;
   padding: 12px 24px;
   font-weight: 500;
   color: #6b7280;
   cursor: pointer;
   border-bottom: 2px solid transparent;
   transition: all 0.2s ease;
}

.tab-button:hover {
   color: #374151;
}

.tab-button.active {
   color: #2563EB;
   border-bottom-color: #2563EB;
}

.tab-panel {
   display: none;
}

.tab-panel.active {
   display: block;
}

/* Dropdowns */
.dropdown {
   position: relative;
   display: inline-block;
}

.dropdown-menu {
   position: absolute;
   top: 100%;
   left: 0;
   min-width: 200px;
   background: white;
   border: 1px solid #e5e7eb;
   border-radius: 8px;
   box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
   opacity: 0;
   visibility: hidden;
   transform: translateY(-8px);
   transition: all 0.2s ease;
   z-index: 1000;
   padding: 8px 0;
}

.dropdown.open .dropdown-menu {
   opacity: 1;
   visibility: visible;
   transform: translateY(0);
}

.dropdown-item {
   display: flex;
   align-items: center;
   gap: 12px;
   padding: 12px 16px;
   color: #374151;
   text-decoration: none;
   transition: background 0.2s ease;
   font-size: 0.875rem;
}

.dropdown-item:hover {
   background: #f3f4f6;
   color: #111827;
}

.dropdown-item i {
   width: 16px;
   color: #6b7280;
}

.dropdown-divider {
   height: 1px;
   background: #e5e7eb;
   margin: 8px 0;
}

/* Back to Top */
.back-to-top {
   position: fixed;
   bottom: 30px;
   right: 30px;
   width: 50px;
   height: 50px;
   background: linear-gradient(135deg, #2563EB, #2563EB);
   color: white;
   border: none;
   border-radius: 50%;
   cursor: pointer;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 1.25rem;
   box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
   opacity: 0;
   visibility: hidden;
   transform: translateY(20px);
   transition: all 0.3s ease;
   z-index: 1000;
}

.back-to-top.show {
   opacity: 1;
   visibility: visible;
   transform: translateY(0);
}

.back-to-top:hover {
   transform: translateY(-2px);
   box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

/* Search Suggestions */
.search-suggestions {
   position: absolute;
   top: 100%;
   left: 0;
   right: 0;
   background: white;
   border: 1px solid #e5e7eb;
   border-radius: 8px;
   box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
   margin-top: 4px;
   max-height: 300px;
   overflow-y: auto;
   z-index: 1000;
   display: none;
}

.suggestion-item {
   display: flex;
   align-items: center;
   gap: 12px;
   padding: 12px 16px;
   cursor: pointer;
   transition: background 0.2s ease;
}

.suggestion-item:hover,
.suggestion-item.active {
   background: #f3f4f6;
}

.suggestion-item i {
   color: #6b7280;
   width: 16px;
}

.suggestion-content {
   flex: 1;
}

.suggestion-title {
   font-weight: 500;
   color: #374151;
   font-size: 0.875rem;
}

.suggestion-type {
   color: #9ca3af;
   font-size: 0.75rem;
}

/* Skip to Content */
.skip-to-content {
   position: absolute;
   top: -40px;
   left: 6px;
   background: #000;
   color: #fff;
   padding: 8px;
   text-decoration: none;
   border-radius: 4px;
   z-index: 10000;
   transition: top 0.3s;
}

.skip-to-content:focus {
   top: 6px;
}

/* Screen Reader Only */
.sr-only {
   position: absolute;
   width: 1px;
   height: 1px;
   padding: 0;
   margin: -1px;
   overflow: hidden;
   clip: rect(0, 0, 0, 0);
   white-space: nowrap;
   border: 0;
}

/* Responsive Utilities */
@media (max-width: 768px) {
   .toast-container {
       left: 20px;
       right: 20px;
       max-width: none;
   }
   
   .modal-overlay {
       padding: 10px;
   }
   
   .dropdown-menu {
       position: fixed;
       top: auto !important;
       left: 10px !important;
       right: 10px !important;
       width: auto;
       min-width: auto;
   }
   
   .back-to-top {
       bottom: 20px;
       right: 20px;
       width: 45px;
       height: 45px;
   }
   
   .btn {
       padding: 10px 20px;
   }
   
   .btn-sm {
       padding: 6px 12px;
   }
   
   .btn-lg {
       padding: 14px 28px;
   }
   
   .form-input,
   .form-select,
   .form-textarea {
       padding: 10px 12px;
   }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
   .card {
       background: #1f2937;
       border-color: #374151;
       color: #f9fafb;
   }
   
   .form-input,
   .form-select,
   .form-textarea {
       background: #374151;
       border-color: #4b5563;
       color: #f9fafb;
   }
   
   .form-input:focus,
   .form-select:focus,
   .form-textarea:focus {
       border-color: #2563EB;
   }
   
   .dropdown-menu {
       background: #1f2937;
       border-color: #374151;
   }
   
   .dropdown-item {
       color: #f9fafb;
   }
   
   .dropdown-item:hover {
       background: #374151;
   }
   
   .search-suggestions {
       background: #1f2937;
       border-color: #374151;
   }
   
   .suggestion-item:hover,
   .suggestion-item.active {
       background: #374151;
   }
   
   .suggestion-title {
       color: #f9fafb;
   }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
   .btn {
       border: 2px solid;
   }
   
   .btn-primary {
       border-color: #000;
       background: #000;
   }
   
   .btn-outline {
       border-color: #000;
       color: #000;
   }
   
   .form-input,
   .form-select,
   .form-textarea {
       border: 2px solid #000;
   }
   
   .card {
       border: 2px solid #000;
   }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
   *,
   *::before,
   *::after {
       animation-duration: 0.01ms !important;
       animation-iteration-count: 1 !important;
       transition-duration: 0.01ms !important;
   }
}

/* Print Styles */
@media print {
   .toast-container,
   .loading-overlay,
   .back-to-top,
   .btn,
   .dropdown-menu {
       display: none !important;
   }
   
   .card {
       box-shadow: none;
       border: 1px solid #000;
       break-inside: avoid;
   }
}