/* ===================================
   Dream X - Enhanced UI Components
   Modern CSS Upgrades for Better UX
   =================================== */

/* =============================
   IMPROVED BUTTON SYSTEM
   ============================= */
.btn {
    position: relative;
    overflow: hidden;
    font-weight: 600;
    transition: all var(--transition-smooth);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-primary);
    box-shadow: var(--shadow-pink);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover {
    box-shadow: var(--shadow-electric);
    transform: translateY(-2px);
    animation: electricGlow 2s ease-in-out infinite;
}

.btn-primary:hover::after {
    left: 100%;
}

.btn-secondary {
    background: transparent;
    border: 2px solid white;
    transition: all var(--transition-smooth);
}

.btn-secondary:hover {
    background: white;
    color: var(--primary-color);
    border-color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    position: relative;
}

.btn-outline::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: var(--gradient-x-logo);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-outline:hover {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-pink);
}

.btn-outline:hover::before {
    opacity: 1;
    animation: electricWave 2s ease-in-out infinite;
}

/* Button sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
}

.btn-md {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-base);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: var(--font-size-lg);
}

/* =============================
   ENHANCED CARDS
   ============================= */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-smooth);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 79, 163, 0.2);
}

.card-elevated {
    box-shadow: var(--shadow-md);
}

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

/* Card with gradient border */
.card-gradient-border {
    position: relative;
    background: var(--bg-white);
    border: none;
}

.card-gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    padding: 2px;
    background: var(--gradient-x-logo);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: electricWave 4s ease-in-out infinite;
}

/* =============================
   IMPROVED FORM INPUTS
   ============================= */
.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    transition: all var(--transition-smooth);
    background: var(--bg-white);
}

.form-control:hover {
    border-color: var(--border-focus);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 79, 163, 0.15), 0 0 12px rgba(0, 242, 254, 0.1);
    transform: translateY(-1px);
    animation: electricSpark 2s ease-in-out infinite;
}

.form-control:disabled {
    background-color: var(--bg-gray);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-control::placeholder {
    color: var(--text-lighter);
}

/* Form group spacing */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--text-dark);
    font-size: var(--font-size-sm);
}

.form-helper {
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-xs);
    color: var(--text-light);
}

.form-error {
    color: var(--error-color);
    font-size: var(--font-size-xs);
    margin-top: var(--spacing-xs);
}

/* =============================
   ENHANCED BADGES & TAGS
   ============================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: 1;
}

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

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

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

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

/* =============================
   LOADING STATES
   ============================= */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 79, 163, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

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

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: var(--font-size-xs);
    white-space: nowrap;
    border-radius: var(--radius-md);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-fast);
    z-index: var(--z-tooltip);
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-fast);
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}

/* =============================
   ALERTS & NOTIFICATIONS
   ============================= */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: start;
    gap: 0.75rem;
    animation: slideInDown 0.3s ease;
}

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

.alert-success {
    background: var(--success-light);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: var(--error-light);
    color: var(--error-color);
    border-left: 4px solid var(--error-color);
}

.alert-warning {
    background: #fef3c7;
    color: var(--warning-color);
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: #dbeafe;
    color: var(--info-color);
    border-left: 4px solid var(--info-color);
}

/* =============================
   PROGRESS BARS
   ============================= */
.progress {
    width: 100%;
    height: 8px;
    background: var(--bg-gray);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-smooth);
}

.progress-bar-animated {
    background: linear-gradient(90deg, #FF4DFF, #A53CFF, #FF4DFF);
    background-size: 200% 100%;
    animation: progressSlide 1.5s linear infinite;
}

@keyframes progressSlide {
    0% { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}

/* =============================
   PAGINATION
   ============================= */
.pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination-item {
    padding: 0.5rem 0.75rem;
    min-width: 40px;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.pagination-item:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

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

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

/* =============================
   TABS
   ============================= */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: var(--spacing-md);
}

.tab {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-light);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.tab:hover {
    color: var(--text-dark);
    background: rgba(255, 79, 163, 0.05);
}

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

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
}

/* =============================
   MODALS
   ============================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    animation: fadeIn 0.3s ease;
}

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

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: var(--font-size-2xl);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(107, 114, 128, 0.1);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-light);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

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

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 0.5rem 0;
    z-index: var(--z-dropdown);
    animation: slideDown 0.2s ease;
}

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

.dropdown-item {
    padding: 0.75rem 1rem;
    color: var(--text-dark);
    text-decoration: none;
    display: block;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.dropdown-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform var(--transition-fast);
}

.dropdown-item:hover::before {
    transform: scaleY(1);
}

.dropdown-item:hover {
    background: rgba(255, 79, 163, 0.05);
    padding-left: 1.25rem;
}

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

/* =============================
   AVATARS
   ============================= */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid rgba(255, 79, 163, 0.2);
    transition: all var(--transition-smooth);
}

.avatar:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(255, 79, 163, 0.3);
}

.avatar-xs {
    width: 24px;
    height: 24px;
}

.avatar-sm {
    width: 40px;
    height: 40px;
}

.avatar-md {
    width: 64px;
    height: 64px;
}

.avatar-lg {
    width: 96px;
    height: 96px;
}

.avatar-xl {
    width: 128px;
    height: 128px;
}

/* Avatar with status indicator */
.avatar-status {
    position: relative;
}

.avatar-status::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--success-color);
    border: 2px solid var(--bg-white);
    border-radius: 50%;
}

.avatar-status.offline::after {
    background: var(--text-lighter);
}

.avatar-status.busy::after {
    background: var(--error-color);
}

/* =============================
   UTILITY CLASSES
   ============================= */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.text-success { color: var(--success-color); }
.text-error { color: var(--error-color); }
.text-warning { color: var(--warning-color); }

.bg-primary { background: var(--gradient-primary); }
.bg-light { background: var(--bg-light); }
.bg-white { background: var(--bg-white); }
.bg-gray { background: var(--bg-gray); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-pink { box-shadow: var(--shadow-pink); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.m-0 { margin: 0; }
.mt-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }

.p-0 { padding: 0; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }

.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
