/**
 * BOOPAS - Animations & Missing Classes
 * Completes the design system with animations and utility classes
 */

/* ===== ANIMATIONS ===== */

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes spin-fast {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes highlight {
    0% { background-color: rgba(255, 255, 255, 0.5); }
    100% { background-color: transparent; }
}

/* ===== FORM CLASSES ===== */

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.form-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    display: block;
}

.form-label .required {
    color: var(--color-error);
    margin-left: var(--spacing-xs);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-top: var(--spacing-xs);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--color-error);
    margin-top: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.form-error i {
    font-size: var(--text-sm);
}

/* ===== HERO SECTION ===== */

.hero {
    position: relative;
    background: linear-gradient(135deg, rgba(209, 32, 32, 0.05), rgba(244, 97, 12, 0.05));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(209, 32, 32, 0.1), transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(244, 97, 12, 0.1), transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.hero > * {
    position: relative;
    z-index: 1;
}

/* ===== PAGE HEADER ===== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-3xl);
    padding-bottom: var(--spacing-2xl);
    border-bottom: 1px solid var(--color-border);
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
    }
}

.page-header-content h1 {
    margin-bottom: var(--spacing-sm);
}

.page-header-content p {
    color: var(--color-text-secondary);
    margin-bottom: 0;
}

.page-header-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ===== TABLE WRAPPER ===== */

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg-primary);
}

.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table-wrapper th {
    background: var(--color-bg-secondary);
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

.table-wrapper td {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

.table-wrapper tr:hover {
    background: var(--color-bg-secondary);
}

.table-wrapper tr:last-child td {
    border-bottom: none;
}

/* ===== STATUS INDICATOR ===== */

.status {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--text-sm);
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status.active .status-dot {
    background: var(--color-success);
}

.status.inactive .status-dot {
    background: var(--color-text-tertiary);
    animation: none;
}

.status.pending .status-dot {
    background: var(--color-warning);
}

.status.error .status-dot {
    background: var(--color-error);
}

/* ===== MODAL ===== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn var(--transition-fast) ease-out;
}

.modal-content {
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp var(--transition-base) ease-out;
}

.modal-header {
    padding: var(--spacing-2xl);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin-bottom: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-xl);
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--color-primary);
}

.modal-footer {
    padding: var(--spacing-2xl);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: var(--spacing-lg);
    justify-content: flex-end;
}

/* ===== DROPDOWN ===== */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    margin-top: var(--spacing-sm);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--color-bg-secondary);
}

/* ===== AVATAR ===== */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    font-weight: 600;
    font-size: var(--text-sm);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--text-xs);
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: var(--text-base);
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ===== TEXT UTILITIES ===== */

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-muted { color: var(--color-text-secondary); }
.text-error { color: var(--color-error); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* ===== DISPLAY UTILITIES ===== */

.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.hidden { display: none; }

/* ===== SIZE UTILITIES ===== */

.w-full { width: 100%; }
.h-full { height: 100%; }
.h-auto { height: auto; }
.max-w-sm { max-width: 384px; }
.max-w-md { max-width: 448px; }
.max-w-lg { max-width: 512px; }
.max-w-xl { max-width: 576px; }
.max-w-2xl { max-width: 672px; }
.max-w-3xl { max-width: 768px; }
.max-w-4xl { max-width: 896px; }

/* ===== OVERFLOW ===== */

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; overflow-y: hidden; }
.overflow-y-auto { overflow-y: auto; overflow-x: hidden; }

/* ===== POSITION ===== */

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.static { position: static; }

/* ===== Z-INDEX ===== */

.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.z-auto { z-index: auto; }

/* ===== OPACITY ===== */

.opacity-0 { opacity: 0; }
.opacity-25 { opacity: 0.25; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* ===== BOX SHADOW ===== */

.shadow-none { box-shadow: none; }
.shadow-xs { box-shadow: var(--shadow-xs); }
.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); }

/* ===== BORDER UTILITIES ===== */

.border { border: 1px solid var(--color-border); }
.border-t { border-top: 1px solid var(--color-border); }
.border-b { border-bottom: 1px solid var(--color-border); }
.border-l { border-left: 1px solid var(--color-border); }
.border-r { border-right: 1px solid var(--color-border); }

.border-primary { border-color: var(--color-primary); }
.border-secondary { border-color: var(--color-secondary); }
.border-error { border-color: var(--color-error); }

/* ===== ROUNDED UTILITIES ===== */

.rounded-none { border-radius: 0; }
.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-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ===== BACKGROUND UTILITIES ===== */

.bg-primary { background: var(--color-primary); color: white; }
.bg-secondary { background: var(--color-secondary); color: white; }
.bg-surface { background: var(--color-surface); }
.bg-muted { background: var(--color-bg-secondary); }

/* ===== DARK MODE FIXES ===== */

@media (prefers-color-scheme: dark) {
    .hero {
        background: linear-gradient(135deg, rgba(209, 32, 32, 0.1), rgba(244, 97, 12, 0.1));
    }
    
    .modal-content {
        background: #161b22;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    }
    
    .page-header {
        border-color: #30363d;
    }
    
    .table-wrapper {
        background: #161b22;
        border-color: #30363d;
    }
    
    .table-wrapper th {
        background: #21262d;
        border-color: #30363d;
    }
    
    .table-wrapper tr:hover {
        background: #21262d;
    }
    
    .modal-header {
        border-color: #30363d;
    }
    
    .modal-footer {
        border-color: #30363d;
    }
    
    .dropdown-menu {
        background: #161b22;
        border-color: #30363d;
    }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 640px) {
    .hero {
        padding: var(--spacing-lg);
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-header-actions {
        justify-content: flex-start;
    }
    
    .modal-content {
        max-width: 100%;
        margin: var(--spacing-lg);
        max-height: calc(100vh - var(--spacing-2xl));
    }
    
    .modal-header,
    .modal-footer {
        padding: var(--spacing-lg);
    }
}

/* ===== PRINT STYLES ===== */

@media print {
    .hero,
    .modal-overlay,
    .dropdown-menu {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
