/**
 * Component UI Styles - Unified styling for extracted DRS components
 * Button, ProgressBar, Card, Panel components with consistent theming
 */

/* =============================================================================
   BUTTON COMPONENT STYLES
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 20px;
    font-size: 16px;
}

/* Button types */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

/* Button content */
.btn-icon {
    display: inline-flex;
    align-items: center;
    font-size: 16px;
}

.btn-text {
    display: inline-flex;
    align-items: center;
}

.btn-spinner {
    display: inline-flex;
    align-items: center;
    animation: spin 1s linear infinite;
}

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

/* =============================================================================
   PROGRESS BAR COMPONENT STYLES
   ============================================================================= */

.progress-bar {
    width: 100%;
    background: #f3f4f6;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

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

.progress-bar:not(.progress-bar-sm):not(.progress-bar-lg) {
    height: 8px;
}

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

.progress-track {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill-primary {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.progress-fill-success {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.progress-fill-warning {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.progress-fill-danger {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.progress-fill-info {
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

.progress-bar-animated .progress-fill {
    animation: progress-shimmer 2s ease-in-out infinite;
}

.progress-bar-striped .progress-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 16px 16px;
    animation: progress-stripes 1s linear infinite;
}

.progress-label {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
    text-align: center;
}

.progress-bar-indeterminate .progress-fill {
    width: 30% !important;
    animation: progress-indeterminate 2s ease-in-out infinite;
}

@keyframes progress-shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes progress-stripes {
    from { background-position: 0 0; }
    to { background-position: 16px 0; }
}

@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}

/* =============================================================================
   CARD COMPONENT STYLES
   ============================================================================= */

.card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: all 0.2s ease;
}

.card-elevated {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.card-interactive:active {
    transform: translateY(0);
}

/* Card sizes */
.card-sm {
    border-radius: 8px;
}

.card-lg {
    border-radius: 16px;
}

/* Card types */
.card-exercise {
    border-left: 4px solid #667eea;
}

.card-question {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(to right, #eff6ff, #ffffff);
}

.card-result {
    border-left: 4px solid #10b981;
}

.card-info {
    border-left: 4px solid #06b6d4;
    background: linear-gradient(to right, #ecfeff, #ffffff);
}

.card-warning {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(to right, #fffbeb, #ffffff);
}

.card-success {
    border-left: 4px solid #10b981;
    background: linear-gradient(to right, #ecfdf5, #ffffff);
}

.card-danger {
    border-left: 4px solid #ef4444;
    background: linear-gradient(to right, #fef2f2, #ffffff);
}

.card-header {
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.card-body {
    padding: 16px 20px;
    color: #374151;
    line-height: 1.6;
}

.card-footer {
    padding: 12px 20px 16px 20px;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
    font-size: 14px;
    color: #6b7280;
}

/* Card animations */
.card-animate-fade {
    animation: card-fade-in 0.3s ease;
}

.card-animate-slide {
    animation: card-slide-in 0.3s ease;
}

.card-animate-scale {
    animation: card-scale-in 0.3s ease;
}

@keyframes card-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes card-scale-in {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* =============================================================================
   PANEL COMPONENT STYLES
   ============================================================================= */

.panel {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.panel-collapsible .panel-header {
    cursor: pointer;
    user-select: none;
}

.panel-collapsed .panel-body {
    display: none;
}

/* Panel types */
.panel-info {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(to right, #eff6ff, #ffffff);
}

.panel-success {
    border-left: 4px solid #10b981;
    background: linear-gradient(to right, #ecfdf5, #ffffff);
}

.panel-warning {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(to right, #fffbeb, #ffffff);
}

.panel-danger {
    border-left: 4px solid #ef4444;
    background: linear-gradient(to right, #fef2f2, #ffffff);
}

.panel-hint {
    border-left: 4px solid #8b5cf6;
    background: linear-gradient(to right, #f5f3ff, #ffffff);
}

.panel-explanation {
    border-left: 4px solid #06b6d4;
    background: linear-gradient(to right, #ecfeff, #ffffff);
}

.panel-header {
    display: flex;
    justify-content: between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid #f3f4f6;
}

.panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    flex: 1;
}

.panel-controls {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.panel-toggle,
.panel-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #6b7280;
    transition: all 0.2s ease;
}

.panel-toggle:hover,
.panel-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
}

.panel-body {
    padding: 16px;
    color: #374151;
    line-height: 1.6;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 768px) {
    .btn {
        padding: 12px 16px;
        font-size: 16px;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 14px;
    }

    .card-header,
    .card-body,
    .card-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .panel-header,
    .panel-body {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */

.component-hidden {
    display: none !important;
}

.component-invisible {
    opacity: 0;
    pointer-events: none;
}

.component-disabled {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

/* Focus management for accessibility */
.component-focus-visible:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card,
    .panel {
        border-width: 2px;
    }

    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .btn,
    .card,
    .panel,
    .progress-fill,
    .btn-spinner {
        transition: none !important;
        animation: none !important;
    }
}