/**
 * RenderCAD Studio Components
 * Unified component library for authenticated pages
 */

/* ========================================
   CARDS
   ======================================== */
.studio-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: var(--space-2xl);
    transition: all var(--transition-normal);
}

.studio-card:hover {
    border-color: var(--border-heavy);
}

.studio-card-header {
    margin-bottom: var(--space-xl);
}

.studio-card-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
}

.studio-card-body {
    color: var(--text-secondary);
}

/* Compact card variant */
.studio-card-compact {
    padding: var(--space-xl);
}

/* Stat card variant */
.studio-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    text-align: center;
    transition: all var(--transition-normal);
}

.studio-stat-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
}

.studio-stat-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    line-height: var(--leading-tight);
}

.studio-stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-sm);
}

.studio-stat-change {
    font-size: var(--text-xs);
    margin-top: var(--space-xs);
}

.studio-stat-change.positive {
    color: var(--success);
}

.studio-stat-change.negative {
    color: var(--error);
}

/* Metrics Panel - Improved Readability */
.studio-metrics-panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    backdrop-filter: blur(8px);
}

.studio-metrics-panel h2,
.studio-metrics-panel h3,
.studio-metrics-panel h4 {
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
}

/* Metrics sections with subtle elevation */
.studio-metrics-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.studio-metrics-section:last-child {
    margin-bottom: 0;
}

/* ========================================
   BADGES
   ======================================== */
.studio-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.studio-badge-success {
    background: var(--success-dim);
    color: var(--success);
    border: 1px solid var(--success);
}

.studio-badge-warning {
    background: var(--warning-dim);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.studio-badge-error {
    background: var(--error-dim);
    color: var(--error);
    border: 1px solid var(--error);
}

.studio-badge-info {
    background: var(--info-dim);
    color: var(--info);
    border: 1px solid var(--info);
}

.studio-badge-neutral {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
}

/* ========================================
   ALERTS
   ======================================== */
.studio-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-xl);
    border-radius: var(--radius-md);
    border-left: 4px solid;
}

.studio-alert-icon {
    flex-shrink: 0;
    font-size: var(--text-lg);
}

.studio-alert-content {
    flex: 1;
}

.studio-alert-title {
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-xs);
}

.studio-alert-message {
    font-size: var(--text-sm);
}

.studio-alert-success {
    background: var(--success-dim);
    border-left-color: var(--success);
    color: var(--text-primary);
}

.studio-alert-success .studio-alert-icon {
    color: var(--success);
}

.studio-alert-warning {
    background: var(--warning-dim);
    border-left-color: var(--warning);
    color: var(--text-primary);
}

.studio-alert-warning .studio-alert-icon {
    color: var(--warning);
}

.studio-alert-error {
    background: var(--error-dim);
    border-left-color: var(--error);
    color: var(--text-primary);
}

.studio-alert-error .studio-alert-icon {
    color: var(--error);
}

.studio-alert-info {
    background: var(--info-dim);
    border-left-color: var(--info);
    color: var(--text-primary);
}

.studio-alert-info .studio-alert-icon {
    color: var(--info);
}

/* ========================================
   TABLES
   ======================================== */
.studio-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.studio-table thead {
    background: var(--bg-surface);
}

.studio-table th {
    padding: var(--space-lg);
    text-align: left;
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-medium);
}

.studio-table td {
    padding: var(--space-lg);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.studio-table tbody tr:last-child td {
    border-bottom: none;
}

.studio-table tbody tr:hover {
    background: var(--bg-surface);
}

/* ========================================
   FORM CONTROLS
   ======================================== */
.studio-input,
.studio-select,
.studio-textarea {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: var(--text-base);
    transition: all var(--transition-normal);
}

.studio-input:focus,
.studio-select:focus,
.studio-textarea:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px var(--accent-cyan-dim);
}

.studio-input::placeholder,
.studio-textarea::placeholder {
    color: var(--text-muted);
}

.studio-input:disabled,
.studio-select:disabled,
.studio-textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.studio-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

.studio-form-group {
    margin-bottom: var(--space-xl);
}

.studio-form-help {
    margin-top: var(--space-xs);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

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

/* ========================================
   MODALS
   ======================================== */
.studio-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.studio-modal {
    background: var(--bg-overlay);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: var(--z-modal);
}

.studio-modal-header {
    padding: var(--space-2xl);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.studio-modal-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
}

.studio-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: var(--text-xl);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.studio-modal-close:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.studio-modal-body {
    padding: var(--space-2xl);
}

.studio-modal-footer {
    padding: var(--space-2xl);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
}

/* ========================================
   LOADING STATES
   ======================================== */
.studio-skeleton {
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.studio-skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.studio-skeleton-text {
    height: 1em;
}

.studio-skeleton-title {
    height: 2em;
    width: 60%;
}

.studio-skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
}

/* ========================================
   DIVIDERS
   ======================================== */
.studio-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-2xl) 0;
}

.studio-divider-vertical {
    width: 1px;
    background: var(--border-light);
    margin: 0 var(--space-xl);
}

/* ========================================
   TOOLTIPS
   ======================================== */
.studio-tooltip {
    position: absolute;
    background: var(--bg-overlay);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-xs);
    color: var(--text-primary);
    white-space: nowrap;
    z-index: var(--z-toast);
    pointer-events: none;
}

.studio-tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border: 4px solid transparent;
}

.studio-tooltip-top .studio-tooltip-arrow {
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: var(--bg-overlay);
}

.studio-tooltip-bottom .studio-tooltip-arrow {
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: var(--bg-overlay);
}

/* ========================================
   FOOTER - Ultra Minimal (No Scroll)
   ======================================== */
.studio-footer-minimal {
    padding: var(--space-md) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.footer-minimal-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.footer-minimal-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    justify-content: center;
}

/* Ensure footer buttons use the same styles as Download All button */
.footer-minimal-buttons .studio-btn-nav {
    background: linear-gradient(-75deg, rgba(255,255,255,0.05), rgba(255,255,255,0.2), rgba(255,255,255,0.05)) !important;
    border: 1px solid rgba(255,255,255,0.5) !important;
    color: white !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05),
                inset 0 -1px 1px rgba(255, 255, 255, 0.5),
                0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.footer-minimal-buttons .studio-btn-nav:hover:not(:disabled) {
    background: linear-gradient(-75deg, rgba(255,255,255,0.1), rgba(255,255,255,0.3), rgba(255,255,255,0.1)) !important;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05),
                inset 0 -1px 1px rgba(255, 255, 255, 0.5),
                0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

.footer-minimal-buttons .studio-btn-nav:active:not(:disabled) {
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.06) 100%) !important;
    transform: translateY(1px) !important;
}

.footer-minimal-brand {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: 'Proxima Nova Thin', 'Inter', sans-serif;
    font-weight: 300;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
}

.footer-minimal-brand img {
    opacity: 0.7;
}

.footer-minimal-brand sup {
    font-size: 0.6em;
    opacity: 0.7;
    margin-left: 1px;
}

.footer-minimal-links {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.footer-minimal-links a {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-minimal-links a:hover {
    color: var(--accent-cyan);
}

@media (max-width: 576px) {
    .footer-minimal-content {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .footer-minimal-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .footer-minimal-buttons .studio-btn-nav {
        width: 100%;
        justify-content: center;
    }
}
