/* ============================================
   CUSTOM SELECT DROPDOWN
   ============================================ */

/* Base Select Wrapper */
.custom-select {
    position: relative;
    width: 100%;
}

/* Native select with custom styling */
.custom-select select,
select.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    padding: 0.75rem 2.75rem 0.75rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    color: #1f2937;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 1rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem 1.25rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 1rem;
    /* More rounded */
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.custom-select select:hover,
select.form-select:hover {
    border-color: #c7d2fe;
    background-color: #fafafa;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.custom-select select:focus,
select.form-select:focus {
    outline: none;
    border-color: #6366f1;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Option styling - limited but works */
.custom-select select option {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    background-color: #ffffff;
    color: #1f2937;
}

.custom-select select option:checked {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #ffffff;
}

/* Dark mode */
.dark .custom-select select,
.dark select.form-select {
    color: #f9fafb;
    background-color: #1f2937;
    border-color: #374151;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

.dark .custom-select select:hover,
.dark select.form-select:hover {
    border-color: #4b5563;
    background-color: #262f3f;
}

.dark .custom-select select:focus,
.dark select.form-select:focus {
    border-color: #818cf8;
    background-color: #1f2937;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.15);
}

.dark .custom-select select option {
    background-color: #1f2937;
    color: #f9fafb;
}

/* Select sizes */
.custom-select-sm select {
    padding: 0.5rem 2.25rem 0.5rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: 0.625rem;
}

.custom-select-lg select {
    padding: 1rem 3rem 1rem 1.25rem;
    font-size: 1rem;
    border-radius: 1rem;
}

/* ============================================
   STYLED SELECT (JavaScript Enhanced)
   ============================================ */

.styled-select {
    position: relative;
    width: 100%;
}

.styled-select-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.styled-select-trigger:hover {
    border-color: #9ca3af;
}

.styled-select-trigger.open {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.dark .styled-select-trigger {
    color: #f3f4f6;
    background-color: #374151;
    border-color: #4b5563;
}

.styled-select-trigger .trigger-text {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.styled-select-trigger .trigger-icon {
    color: #6b7280;
    transition: transform 0.2s ease;
}

.styled-select-trigger.open .trigger-icon {
    transform: rotate(180deg);
}

.styled-select-trigger .trigger-prefix {
    font-size: 1.25rem;
}

/* Dropdown menu */
.styled-select-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

.styled-select-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dark .styled-select-menu {
    background-color: #1f2937;
    border-color: #374151;
}

/* Menu items */
.styled-select-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.styled-select-item:first-child {
    border-radius: 0.75rem 0.75rem 0 0;
}

.styled-select-item:last-child {
    border-radius: 0 0 0.75rem 0.75rem;
}

.styled-select-item:hover {
    background-color: #f3f4f6;
}

.styled-select-item.selected {
    background-color: #eef2ff;
    color: #4f46e5;
    font-weight: 500;
}

.dark .styled-select-item {
    color: #e5e7eb;
}

.dark .styled-select-item:hover {
    background-color: #374151;
}

.dark .styled-select-item.selected {
    background-color: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.styled-select-item .item-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.styled-select-item .item-check {
    margin-left: auto;
    color: #6366f1;
}

/* Search in select */
.styled-select-search {
    position: sticky;
    top: 0;
    padding: 0.5rem;
    background-color: inherit;
    border-bottom: 1px solid #e5e7eb;
}

.dark .styled-select-search {
    border-color: #374151;
}

.styled-select-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #374151;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    outline: none;
}

.dark .styled-select-search input {
    color: #e5e7eb;
    background-color: #374151;
    border-color: #4b5563;
}

.styled-select-search input:focus {
    border-color: #6366f1;
}

/* Empty state */
.styled-select-empty {
    padding: 1.5rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* ============================================
   FORM STYLES
   ============================================ */

/* Input base */
.form-input {
    width: 100%;
    padding: 0.75rem 1.125rem;
    font-size: 0.875rem;
    color: #374151;
    background-color: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 1rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.form-input:hover {
    border-color: #c7d2fe;
    background-color: #fafafa;
}

.form-input:focus {
    outline: none;
    border-color: #6366f1;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.dark .form-input {
    color: #f3f4f6;
    background-color: #1f2937;
    border-color: #374151;
}

.dark .form-input:hover {
    background-color: #262f3f;
    border-color: #4b5563;
}

.dark .form-input:focus {
    border-color: #818cf8;
    background-color: #1f2937;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.15);
}

/* Input with icon */
.form-input-icon {
    position: relative;
}

.form-input-icon .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.form-input-icon input {
    padding-left: 2.75rem;
}

/* Error state */
.form-input.error,
.custom-select select.error {
    border-color: #ef4444;
}

.form-input.error:focus,
.custom-select select.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: translateY(-1px);
}

.btn-secondary {
    color: #374151;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

.dark .btn-secondary {
    color: #e5e7eb;
    background-color: #374151;
    border-color: #4b5563;
}

.dark .btn-secondary:hover {
    background-color: #4b5563;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background-color: #ffffff;
    border: 1px solid #f3f4f6;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

.dark .card {
    background-color: #1f2937;
    border-color: #374151;
}

.card-header {
    padding: 1.25rem;
    border-bottom: 1px solid #f3f4f6;
}

.dark .card-header {
    border-color: #374151;
}

.card-body {
    padding: 1.25rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.animate-fade-in {
    animation: fadeIn 0.2s ease;
}

.animate-slide-up {
    animation: slideUp 0.3s ease;
}