/* Component Styles - Wild Child / Gongbi Theme */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-600);
    color: white;
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
}

.btn-primary:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--primary-700);
    border: 1px solid var(--primary-500);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--primary-700);
}

.btn-success {
    background: var(--secondary-600);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: var(--secondary-500);
    transform: translateY(-1px);
}

.btn-lg {
    padding: var(--space-3) var(--space-8);
    font-size: var(--font-size-base);
}

/* Cards */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-500);
}

/* Matrix Grid - Resized to be more compact */
.matrix-grid {
    display: grid;
    /* Reduced column width */
    grid-template-columns: 60px repeat(3, 1fr);
    grid-template-rows: 40px repeat(3, 1fr);
    gap: var(--space-2);
    margin: var(--space-6) auto;
    max-width: 750px;
    /* Limit total width */
}

.matrix-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-weight: var(--font-weight-bold);
    color: var(--gray-600);
    font-size: var(--font-size-sm);
}

.matrix-label-vertical {
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.matrix-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: var(--space-2);
    position: relative;
}

.matrix-cell:hover {
    border-color: var(--primary-500);
    background: var(--gray-50);
    transform: scale(1.02);
}

.matrix-cell.selected {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-700);
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}

/* Seal/Stamp effect for selected cell */
.matrix-cell.selected::after {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
}

.matrix-cell-code {
    font-family: var(--font-serif);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: 0;
}

.matrix-cell-label {
    font-size: 0.7rem;
    text-align: center;
    line-height: 1.2;
    margin-top: var(--space-1);
    opacity: 0.9;
}

/* Style Options */
.style-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
    margin: var(--space-4) 0;
}

.style-option {
    padding: var(--space-3);
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.style-option:hover {
    border-color: var(--primary-500);
    background: var(--gray-50);
}

.style-option.selected {
    border-color: var(--primary-600);
    background: var(--primary-600);
    color: white;
    box-shadow: var(--shadow-md);
}

.style-option-label {
    font-family: var(--font-serif);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-base);
}

.style-option-desc {
    font-size: var(--font-size-xs);
    margin-top: var(--space-1);
    opacity: 0.8;
}

/* Batch Processing Styles */
.batch-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.batch-step {
    background: white;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.batch-step-title {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    color: var(--primary-800);
    margin-bottom: var(--space-2);
}

.batch-step-desc {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: var(--space-4);
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--gray-50);
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    color: var(--primary-700);
    font-weight: 500;
}

.file-icon {
    font-size: 2rem;
}

#fileName {
    color: var(--primary-700);
    font-weight: 500;
}

/* Batch buttons - more visible */
.batch-step .btn-outline {
    color: var(--primary-700);
    font-weight: 600;
    border-width: 2px;
}

.batch-step .btn-outline:hover {
    background: var(--primary-600);
    color: white;
}

/* Progress Bar */
.progress-container {
    margin-top: var(--space-4);
}

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-top: var(--space-2);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-family: var(--font-serif);
    font-weight: var(--font-weight-bold);
    color: var(--gray-700);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
}

.form-input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
    background: var(--gray-50);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-500);
    background: white;
    box-shadow: 0 0 0 3px rgba(93, 122, 115, 0.1);
}

/* Badges & Tags */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: var(--font-weight-medium);
    background: var(--gray-200);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

/* Collapsible Section */
.collapsible {
    overflow: hidden;
    transition: all var(--transition-base);
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: var(--space-3) var(--space-4);
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.collapsible-header:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.collapsible-icon {
    transition: transform var(--transition-base);
    font-size: 0.8em;
    color: var(--gray-500);
}

.collapsible.open .collapsible-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.collapsible.open .collapsible-content {
    max-height: 1000px;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Success Checkmark Animation */
.checkmark {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--secondary-600);
    position: relative;
    animation: checkmark-pop 0.4s ease-out;
}

.checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

@keyframes checkmark-pop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-text {
    visibility: hidden;
    background-color: var(--gray-800);
    color: var(--gray-50);
    text-align: center;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    opacity: 0;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Step Indicator */
.step-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-600);
    color: white;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-xs);
    font-family: var(--font-serif);
}

.step-title {
    font-family: var(--font-serif);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--gray-800);
}