/**
 * Shazi Video Gen - UI Components
 * Modern, enterprise-grade component styles
 */

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--accent-hover) 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn:hover::before {
    opacity: 1;
}

.btn:active {
    transform: translateY(0);
}

.btn span,
.btn i {
    position: relative;
    z-index: 2;
}

/* Fix hover text visibility - ensure ::before stays behind text */
.btn::before {
    z-index: -1;
}

/* Ensure text stays white on hover */
.btn:hover {
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: var(--text-xs);
}

.btn-lg {
    padding: 16px 32px;
    font-size: var(--text-base);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text);
}

.btn-outline::before {
    background: var(--surface-hover);
}

.btn-outline:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.btn-success::before {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
}

.btn-danger::before {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--surface-hover);
    transform: none;
    box-shadow: none;
}

/* ============================================================================
   CARDS
   ============================================================================ */
.card {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.card-elevated {
    box-shadow: var(--shadow-xl);
}

.card-gradient {
    background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface-1) 100%);
    border: 1px solid var(--border-light);
}

.card-featured {
    border: 2px solid var(--primary);
    position: relative;
}

.card-featured::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: inherit;
    z-index: -1;
    opacity: 0.2;
    filter: blur(20px);
}

/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--text);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    outline: none;
}

.form-control:hover {
    border-color: var(--border-light);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface-2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* ============================================================================
   BADGES
   ============================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    color: var(--success);
    background: var(--success-bg);
}

.badge-warning {
    color: var(--warning);
    background: var(--warning-bg);
}

.badge-danger {
    color: var(--danger);
    background: var(--danger-bg);
}

.badge-info {
    color: var(--info);
    background: var(--info-bg);
}

.badge-primary {
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.15);
}

/* ============================================================================
   TABLES
   ============================================================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

th {
    padding: var(--space-md);
    font-size: var(--text-xs);
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

td {
    padding: var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

tbody tr:hover td {
    background: var(--surface-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================================
   ALERTS
   ============================================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    border: 1px solid;
}

.alert-success {
    color: var(--success);
    background: var(--success-bg);
    border-color: rgba(16, 185, 129, 0.3);
}

.alert-error {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: rgba(239, 68, 68, 0.3);
}

.alert-warning {
    color: var(--warning);
    background: var(--warning-bg);
    border-color: rgba(245, 158, 11, 0.3);
}

.alert-info {
    color: var(--info);
    background: var(--info-bg);
    border-color: rgba(59, 130, 246, 0.3);
}

/* ============================================================================
   STAT CARDS
   ============================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-value {
    font-size: var(--text-4xl);
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: var(--space-sm);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-xs);
    margin-top: var(--space-sm);
}

.stat-trend.up {
    color: var(--success);
}

.stat-trend.down {
    color: var(--danger);
}

/* ============================================================================
   MODALS
   ============================================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: var(--z-modal-backdrop);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    animation: fadeIn var(--transition-base);
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp var(--transition-base);
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
}

/* ============================================================================
   PAGE HEADER
   ============================================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-header h1 {
    font-size: var(--text-2xl);
    font-weight: 700;
}

/* ============================================================================
   LICENSE KEY DISPLAY
   ============================================================================ */
.license-key {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    background: var(--surface-2);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    letter-spacing: 0.5px;
}

/* ============================================================================
   PAGINATION
   ============================================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
}

.pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--transition-base);
}

.animate-slide-up {
    animation: slideUp var(--transition-base);
}

.animate-pulse {
    animation: pulse 2s infinite;
}