/* =======================================
   BUTTONS
   ======================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.5;
    position: relative;
    overflow: hidden;
}

.btn--primary {
    background: var(--brand-gradient);
    color: white;
    font-weight: 600;
}

.btn--primary:hover {
    box-shadow: var(--shadow-glow-purple);
    filter: brightness(1.1);
}

.btn--primary:active {
    filter: brightness(0.95);
}

.btn--secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn--secondary:hover {
    background: var(--border-subtle);
    border-color: var(--border-default);
}

.btn--ghost {
    color: var(--text-secondary);
}

.btn--ghost:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn--danger {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn--danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn--icon {
    padding: var(--space-sm);
    width: 36px;
    height: 36px;
}

.btn--sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.btn--sm.btn--icon {
    width: 28px;
    height: 28px;
}

.btn--lg {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--text-base);
    border-radius: var(--radius-md);
}

.btn--lg.btn--icon {
    width: 48px;
    height: 48px;
}

.btn--full {
    width: 100%;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn--sm svg {
    width: 14px;
    height: 14px;
}

.btn--lg svg {
    width: 20px;
    height: 20px;
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* =======================================
   FORM CONTROLS
   ======================================= */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.input-group__label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group__error {
    font-size: var(--text-xs);
    color: var(--priority-urgent);
}

.input {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    width: 100%;
}

.input:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.input::placeholder {
    color: var(--text-tertiary);
}

.input--error {
    border-color: var(--priority-urgent);
}

.input--error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    width: 100%;
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

.textarea:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.textarea::placeholder {
    color: var(--text-tertiary);
}

.select {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239B97B0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.select:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

/* =======================================
   BADGES
   ======================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 2px var(--space-sm);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    white-space: nowrap;
}

.badge--purple {
    background: rgba(139, 92, 246, 0.15);
    color: var(--brand-purple);
}

.badge--cyan {
    background: rgba(6, 182, 212, 0.15);
    color: var(--brand-cyan);
}

.badge--magenta {
    background: rgba(217, 70, 239, 0.15);
    color: var(--brand-magenta);
}

.badge--green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge--amber {
    background: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
}

.badge--red {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
}

/* Stage-specific badge variants */
.badge--pre-production {
    background: rgba(6, 182, 212, 0.15);
    color: var(--stage-pre-production);
}

.badge--production {
    background: rgba(139, 92, 246, 0.15);
    color: var(--stage-production);
}

.badge--post-production {
    background: rgba(217, 70, 239, 0.15);
    color: var(--stage-post-production);
}

.badge--review {
    background: rgba(245, 158, 11, 0.15);
    color: var(--stage-review);
}

.badge--delivery {
    background: rgba(16, 185, 129, 0.15);
    color: var(--stage-delivery);
}

/* =======================================
   AVATAR
   ======================================= */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    background: var(--brand-purple);
    overflow: hidden;
}

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

.avatar--sm {
    width: 24px;
    height: 24px;
    font-size: 10px;
}

.avatar--md {
    width: 32px;
    height: 32px;
    font-size: var(--text-xs);
}

.avatar--lg {
    width: 48px;
    height: 48px;
    font-size: var(--text-base);
}

/* =======================================
   MODAL
   ======================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
    animation: fadeIn var(--transition-fast);
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp var(--transition-base);
}

.modal--sm { max-width: 400px; }
.modal--md { max-width: 560px; }
.modal--lg { max-width: 720px; }
.modal--xl { max-width: 900px; }

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.modal__title {
    font-size: var(--text-lg);
    font-weight: 600;
}

.modal__close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.modal__close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.modal__body {
    padding: var(--space-lg);
}

.modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

/* =======================================
   TOAST NOTIFICATIONS
   ======================================= */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 280px;
    max-width: 400px;
    animation: slideInRight var(--transition-base);
}

.toast--exiting {
    animation: slideOutRight var(--transition-base) forwards;
}

.toast--success { border-left: 3px solid var(--accent-green); }
.toast--error   { border-left: 3px solid var(--priority-urgent); }
.toast--warning { border-left: 3px solid var(--priority-high); }
.toast--info    { border-left: 3px solid var(--brand-cyan); }

.toast__icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.toast__message {
    flex: 1;
    min-width: 0;
}

.toast__close {
    margin-left: auto;
    color: var(--text-tertiary);
    cursor: pointer;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.toast__close:hover {
    color: var(--text-primary);
}

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

.dropdown__menu {
    position: absolute;
    top: calc(100% + var(--space-xs));
    left: 0;
    min-width: 200px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-xs);
    z-index: 200;
    display: none;
    animation: fadeIn var(--transition-fast);
}

.dropdown__menu--right {
    left: auto;
    right: 0;
}

.dropdown__menu.open {
    display: block;
}

.dropdown__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.dropdown__item:hover {
    background: rgba(139, 92, 246, 0.1);
}

.dropdown__item--danger {
    color: #EF4444;
}

.dropdown__item--danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.dropdown__item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.dropdown__divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-xs) 0;
}

/* =======================================
   TABS
   ======================================= */
.tabs {
    display: flex;
    gap: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
}

.tabs__item {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tabs__item:hover {
    color: var(--text-primary);
}

.tabs__item--active {
    color: var(--brand-purple);
    border-bottom-color: var(--brand-purple);
}

.tabs__item__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 600;
    margin-left: var(--space-xs);
}

.tabs__item--active .tabs__item__count {
    background: rgba(139, 92, 246, 0.15);
    color: var(--brand-purple);
}

/* =======================================
   PROGRESS BAR
   ======================================= */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar--sm {
    height: 4px;
}

.progress-bar--lg {
    height: 10px;
}

.progress-bar__fill {
    height: 100%;
    background: var(--brand-gradient);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
    position: relative;
}

.progress-bar__fill--green {
    background: var(--accent-green);
}

.progress-bar__fill--cyan {
    background: var(--brand-cyan);
}

.progress-bar__fill--purple {
    background: var(--brand-purple);
}

.progress-bar__fill--magenta {
    background: var(--brand-magenta);
}

.progress-bar__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* =======================================
   EMPTY STATE
   ======================================= */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
    min-height: 300px;
}

.empty-state__icon {
    width: 64px;
    height: 64px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state__title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.empty-state__desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    max-width: 400px;
    margin-bottom: var(--space-lg);
}

/* =======================================
   TAGS
   ======================================= */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px var(--space-sm);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.tag--interactive {
    cursor: pointer;
}

.tag--interactive:hover {
    background: var(--border-subtle);
    color: var(--text-primary);
}

.tag--cyan {
    background: rgba(6, 182, 212, 0.12);
    color: var(--brand-cyan);
}

.tag--purple {
    background: rgba(139, 92, 246, 0.12);
    color: var(--brand-purple);
}

.tag--magenta {
    background: rgba(217, 70, 239, 0.12);
    color: var(--brand-magenta);
}

.tag--green {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.tag--amber {
    background: rgba(245, 158, 11, 0.12);
    color: #F59E0B;
}

.tag__remove {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.tag__remove:hover {
    opacity: 1;
}

/* =======================================
   DIVIDER
   ======================================= */
.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-md) 0;
}

/* =======================================
   COLOR DOT
   ======================================= */
.color-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    display: inline-block;
    flex-shrink: 0;
}

/* =======================================
   CHECKBOX
   ======================================= */
.checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: var(--text-sm);
}

.checkbox__input {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: transparent;
    appearance: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.checkbox__input:checked {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.checkbox__input:checked::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* =======================================
   SCREEN READER ONLY
   ======================================= */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =======================================
   ANIMATIONS
   ======================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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