/* ================================
   Component Styles
   ================================ */

/* ================================
   Alert Components
   ================================ */

.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    border: 1px solid transparent;
}

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

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

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

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

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

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.125rem;
    cursor: pointer;
    color: currentColor;
    opacity: 0.7;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.alert-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

/* ================================
   Badge Components
   ================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary {
    background: var(--primary-color);
    color: white;
}

.badge-secondary {
    background: var(--secondary-color);
    color: white;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: white;
}

.badge-error {
    background: var(--error-color);
    color: white;
}

.badge-outline {
    background: transparent;
    border: 2px solid currentColor;
}

.badge-large {
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

/* ================================
   Card Components
   ================================ */

.card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--bg-secondary);
}

.card-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.card-body {
    padding: 2rem;
}

.card-footer {
    padding: 1rem 2rem;
    border-top: 1px solid var(--gray-200);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* Card Variants */
.card-elevated {
    box-shadow: var(--shadow-xl);
    border: none;
}

.card-bordered {
    border: 2px solid var(--primary-color);
}

.card-gradient {
    background: var(--bg-gradient);
    color: white;
    border: none;
}

.card-gradient .card-header {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-gradient .card-footer {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ================================
   Dropdown Components
   ================================ */

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

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    min-width: 200px;
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-fast);
}

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

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--gray-100);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.5rem 0;
}

/* ================================
   Tab Components
   ================================ */

.tabs {
    margin-bottom: 2rem;
}

.tab-list {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    gap: 0;
}

.tab-button {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition-fast);
    position: relative;
}

.tab-button:hover {
    color: var(--primary-color);
    background: var(--bg-secondary);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    padding: 2rem 0;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fade-in-up 0.3s ease;
}

/* ================================
   Accordion Components
   ================================ */

.accordion {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.accordion-item {
    border-bottom: 1px solid var(--gray-200);
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    background: var(--bg-secondary);
    border: none;
    width: 100%;
    padding: 1.25rem 1.5rem;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-fast);
}

.accordion-header:hover {
    background: var(--gray-100);
}

.accordion-header.active {
    background: var(--primary-color);
    color: white;
}

.accordion-icon {
    font-size: 1.25rem;
    transition: transform var(--transition-fast);
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-content.active {
    max-height: 500px;
}

.accordion-body {
    padding: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ================================
   Tooltip Components
   ================================ */

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

.tooltip-content {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
    z-index: var(--z-tooltip);
    pointer-events: none;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--gray-800);
}

.tooltip:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* Tooltip Positions */
.tooltip-top .tooltip-content {
    bottom: 125%;
    top: auto;
}

.tooltip-bottom .tooltip-content {
    top: 125%;
    bottom: auto;
}

.tooltip-bottom .tooltip-content::after {
    top: -10px;
    border-top-color: transparent;
    border-bottom-color: var(--gray-800);
}

.tooltip-left .tooltip-content {
    top: 50%;
    right: 125%;
    left: auto;
    transform: translateY(-50%);
}

.tooltip-left .tooltip-content::after {
    top: 50%;
    left: 100%;
    right: auto;
    transform: translateY(-50%);
    border-left-color: var(--gray-800);
    border-top-color: transparent;
}

.tooltip-right .tooltip-content {
    top: 50%;
    left: 125%;
    right: auto;
    transform: translateY(-50%);
}

.tooltip-right .tooltip-content::after {
    top: 50%;
    right: 100%;
    left: auto;
    transform: translateY(-50%);
    border-right-color: var(--gray-800);
    border-top-color: transparent;
}

/* ================================
   Breadcrumb Components
   ================================ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumb-item a:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--text-light);
}

/* ================================
   Pagination Components
   ================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
}

.pagination-item:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-item.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-prev,
.pagination-next {
    padding: 0 1rem;
    width: auto;
}

/* ================================
   Progress Components
   ================================ */

.progress {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar {
    height: 100%;
    background: var(--bg-gradient);
    border-radius: 4px;
    transition: width 0.8s ease;
    position: relative;
}

.progress-striped .progress-bar {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
}

.progress-animated .progress-bar {
    animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
    0% {
        background-position: 1rem 0;
    }
    100% {
        background-position: 0 0;
    }
}

/* Progress Sizes */
.progress-sm {
    height: 4px;
}

.progress-lg {
    height: 12px;
}

.progress-xl {
    height: 16px;
}

/* ================================
   List Components
   ================================ */

.list-group {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.list-group-item {
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-fast);
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background: var(--bg-secondary);
}

.list-group-item.active {
    background: var(--primary-color);
    color: white;
}

.list-group-item-action {
    cursor: pointer;
}

.list-group-item-content {
    flex: 1;
}

.list-group-item-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.list-group-item-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.list-group-item.active .list-group-item-text {
    color: rgba(255, 255, 255, 0.8);
}

/* ================================
   Input Group Components
   ================================ */

.input-group {
    display: flex;
    width: 100%;
    margin-bottom: 1rem;
}

.input-group-prepend,
.input-group-append {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 2px solid var(--gray-200);
    color: var(--text-secondary);
    font-weight: 500;
}

.input-group-prepend {
    border-right: none;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-group-append {
    border-left: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.input-group input {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
}

.input-group input:first-child {
    border-left: 2px solid var(--gray-200) !important;
    border-radius: var(--border-radius) 0 0 var(--border-radius) !important;
}

.input-group input:last-child {
    border-right: 2px solid var(--gray-200) !important;
    border-radius: 0 var(--border-radius) var(--border-radius) 0 !important;
}

/* ================================
   Avatar Components
   ================================ */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-gradient);
    color: white;
    font-weight: 600;
    overflow: hidden;
    position: relative;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
}

.avatar-md {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}

.avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 1.25rem;
}

.avatar-xl {
    width: 96px;
    height: 96px;
    font-size: 1.5rem;
}

.avatar-group {
    display: flex;
    align-items: center;
}

.avatar-group .avatar {
    margin-left: -0.5rem;
    border: 2px solid white;
    position: relative;
    z-index: 1;
}

.avatar-group .avatar:first-child {
    margin-left: 0;
}

.avatar-group .avatar:hover {
    z-index: 2;
    transform: scale(1.1);
}

/* ================================
   Spinner Components
   ================================ */

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 1px;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

.spinner-dots {
    display: inline-flex;
    gap: 4px;
}

.spinner-dots span {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    animation: spinner-dots 1.4s ease-in-out infinite both;
}

.spinner-dots span:nth-child(1) { animation-delay: -0.32s; }
.spinner-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes spinner-dots {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* ================================
   Responsive Component Adjustments
   ================================ */

@media (max-width: 768px) {
    .card-body {
        padding: 1.5rem;
    }
    
    .card-header,
    .card-footer {
        padding: 1rem 1.5rem;
    }
    
    .dropdown-menu {
        position: fixed;
        left: 1rem !important;
        right: 1rem !important;
        width: auto !important;
        min-width: auto;
    }
    
    .tab-list {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .tab-list::-webkit-scrollbar {
        display: none;
    }
    
    .tab-button {
        white-space: nowrap;
        min-width: 120px;
    }
    
    .accordion-header {
        padding: 1rem;
    }
    
    .accordion-body {
        padding: 1rem;
    }
    
    .breadcrumb {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .breadcrumb::-webkit-scrollbar {
        display: none;
    }
    
    .pagination {
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0 1rem;
    }
    
    .pagination-item {
        flex-shrink: 0;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group-prepend,
    .input-group-append {
        border-radius: var(--border-radius);
        border: 2px solid var(--gray-200);
    }
    
    .input-group input {
        border-radius: var(--border-radius) !important;
        border: 2px solid var(--gray-200) !important;
    }
    
    .avatar-group .avatar {
        margin-left: -0.25rem;
    }
}

/* ================================
   Dark Mode Support (for future use)
   ================================ */

@media (prefers-color-scheme: dark) {
    .card,
    .dropdown-menu,
    .accordion,
    .list-group {
        background: var(--gray-800);
        border-color: var(--gray-600);
        color: white;
    }
    
    .card-header,
    .card-footer,
    .accordion-header {
        background: var(--gray-700);
        border-color: var(--gray-600);
    }
    
    .list-group-item {
        background: var(--gray-800);
        border-color: var(--gray-600);
        color: white;
    }
    
    .input-group-prepend,
    .input-group-append {
        background: var(--gray-700);
        border-color: var(--gray-600);
        color: white;
    }
    
    .pagination-item {
        background: var(--gray-800);
        border-color: var(--gray-600);
        color: white;
    }
    
    .tooltip-content {
        background: var(--gray-700);
    }
}
