/**
 * Custom Tailor 前端样式
 * assets/css/frontend.css
 */

/* ===== 基础样式 ===== */
.ct-designer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* ===== 进度条样式 ===== */
.ct-progress-bar {
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid #e0e0e0;
}

.ct-progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.ct-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.ct-progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15px;
    left: calc(100% + 10px);
    right: calc(-100% - 10px);
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
    transition: background 0.3s ease;
}

.ct-progress-step.completed:not(:last-child)::after {
    background: #4CAF50;
}

.ct-step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    z-index: 1;
    position: relative;
}

.ct-step-label {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    text-align: center;
    transition: color 0.3s ease;
}

.ct-progress-step.active .ct-step-number {
    background: #2196F3;
    color: white;
}

.ct-progress-step.active .ct-step-label {
    color: #2196F3;
    font-weight: 600;
}

.ct-progress-step.completed .ct-step-number {
    background: #4CAF50;
    color: white;
}

.ct-progress-step.completed .ct-step-label {
    color: #4CAF50;
}

.ct-progress-step:hover:not(.active) .ct-step-number {
    background: #f0f0f0;
}

/* ===== 主要内容区域 ===== */
.ct-designer-main {
    display: flex;
    gap: 30px;
    min-height: 500px;
}

.ct-options-panel {
    flex: 1;
    max-width: 60%;
}

.ct-preview-panel {
    flex: 0 0 350px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

/* ===== 步骤内容样式 ===== */
.ct-step-panel {
    animation: fadeIn 0.3s ease;
}

.ct-step-header {
    margin-bottom: 25px;
}

.ct-step-header h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.ct-step-header p {
    margin: 0;
    color: #666;
    font-size: 16px;
    line-height: 1.5;
}

/* ===== 面料选择样式 ===== */
.ct-fabric-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.ct-filter-group,
.ct-search-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ct-filter-group label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.ct-select,
.ct-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.ct-select:focus,
.ct-input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.ct-fabric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.ct-fabric-option {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    position: relative;
    overflow: hidden;
}

.ct-fabric-option:hover {
    border-color: #2196F3;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.ct-fabric-option.selected {
    border-color: #4CAF50;
    background: #f8fff8;
}

.ct-fabric-option.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4CAF50;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.ct-fabric-image {
    width: 100%;
    height: 150px;
    margin-bottom: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
}

.ct-fabric-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ct-fabric-option:hover .ct-fabric-image img {
    transform: scale(1.05);
}

.ct-fabric-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
}

.ct-fabric-description {
    font-size: 14px;
    color: #666;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.ct-fabric-price {
    font-size: 16px;
    font-weight: bold;
    color: #2196F3;
}

/* ===== 款式选择样式 ===== */
.ct-style-categories {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.ct-style-category {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: white;
}

.ct-category-title {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.ct-style-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.ct-style-option {
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    position: relative;
}

.ct-style-option:hover {
    border-color: #2196F3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ct-style-option.selected {
    border-color: #4CAF50;
    background: #f8fff8;
}

.ct-style-option.selected::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    background: #4CAF50;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.ct-style-image {
    width: 100%;
    height: 60px;
    margin-bottom: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5f5;
}

.ct-style-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ct-style-name {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 5px 0;
    color: #333;
    line-height: 1.3;
}

.ct-style-price {
    font-size: 12px;
    color: #2196F3;
    font-weight: 600;
}

/* ===== 尺寸选择样式 ===== */
.ct-size-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.ct-size-tab {
    flex: 1;
    padding: 12px 20px;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    border-right: 1px solid #e0e0e0;
}

.ct-size-tab:last-child {
    border-right: none;
}

.ct-size-tab:hover {
    background: #e9ecef;
}

.ct-size-tab.active {
    background: #2196F3;
    color: white;
}

.ct-size-content {
    position: relative;
}

.ct-size-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.ct-size-panel.active {
    display: block;
}

.ct-standard-sizes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.ct-size-option {
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    position: relative;
}

.ct-size-option:hover {
    border-color: #2196F3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ct-size-option.selected {
    border-color: #4CAF50;
    background: #f8fff8;
}

.ct-size-option.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: #4CAF50;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.ct-size-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.ct-size-info {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
}

/* ===== 自定义尺寸表单 ===== */
.ct-measurement-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.ct-measurement-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ct-measurement-group label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.ct-measurement-input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.ct-measurement-input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.ct-save-size {
    grid-column: 1 / -1;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.ct-save-size label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.ct-save-size input[type="checkbox"] {
    margin: 0;
}

.ct-save-size .ct-input {
    margin-top: 10px;
    width: 200px;
}

/* ===== 保存的尺寸样式 ===== */
.ct-saved-sizes {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ct-saved-size-option {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    background: white;
}

.ct-saved-size-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.ct-default-badge {
    background: #4CAF50;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.ct-saved-size-info {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.ct-btn-use-saved-size {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ct-btn-use-saved-size:hover {
    background: #1976D2;
}

/* ===== 摘要样式 ===== */
.ct-design-summary {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.ct-summary-section {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: white;
}

.ct-summary-section h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.ct-summary-fabric {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ct-summary-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.ct-summary-details h5 {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.ct-summary-price {
    color: #2196F3;
    font-weight: 600;
}

.ct-summary-style-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.ct-summary-style-item:last-child {
    border-bottom: none;
}

.ct-summary-style-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.ct-style-category {
    font-size: 10px;
    background: #f0f0f0;
    color: #666;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.ct-summary-style-details h6 {
    margin: 2px 0;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.ct-summary-style-price {
    color: #2196F3;
    font-size: 12px;
    font-weight: 600;
}

.ct-price-breakdown-detailed {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ct-price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.ct-price-item.ct-total-price {
    border-top: 2px solid #e0e0e0;
    margin-top: 10px;
    padding-top: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.ct-summary-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ct-quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ct-quantity-selector label {
    font-weight: 500;
    color: #333;
}

.ct-quantity-input {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.ct-special-instructions label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.ct-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.ct-textarea:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

/* ===== 预览面板样式 ===== */
.ct-preview-container {
    text-align: center;
}

.ct-preview-image {
    position: relative;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ct-preview-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.ct-preview-container.zoomed .ct-preview-image img {
    transform: scale(1.5);
}

.ct-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ct-preview-image:hover .ct-preview-overlay {
    opacity: 1;
}

.ct-preview-controls {
    display: flex;
    gap: 10px;
}

.ct-btn-3d,
.ct-btn-zoom {
    background: white;
    color: #333;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ct-btn-3d:hover,
.ct-btn-zoom:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
}

/* ===== 价格显示样式 ===== */
.ct-price-display {
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e0e0e0;
}

.ct-price-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ct-base-price,
.ct-extra-price {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #666;
}

.ct-total-price {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    margin-top: 5px;
}

.ct-price-value {
    font-weight: 600;
    color: #2196F3;
}

/* ===== 底部操作按钮样式 ===== */
.ct-designer-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.ct-navigation-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.ct-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
}

.ct-btn-primary {
    background: #2196F3;
    color: white;
}

.ct-btn-primary:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.ct-btn-secondary {
    background: #6c757d;
    color: white;
}

.ct-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.ct-btn-success {
    background: #4CAF50;
    color: white;
}

.ct-btn-success:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.ct-btn-outline {
    background: transparent;
    color: #2196F3;
    border: 2px solid #2196F3;
}

.ct-btn-outline:hover {
    background: #2196F3;
    color: white;
}

.ct-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== 加载和消息样式 ===== */
.ct-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 12px;
}

.ct-loading-spinner {
    text-align: center;
}

.ct-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.ct-loading-placeholder {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.ct-error-message {
    text-align: center;
    padding: 20px;
    color: #d32f2f;
    background: #ffebee;
    border-radius: 6px;
    border: 1px solid #ffcdd2;
}

.ct-no-results,
.ct-no-selection {
    text-align: center;
    padding: 30px;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px dashed #ddd;
}

.ct-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: none;
}

.ct-message-success {
    background: #4CAF50;
}

.ct-message-error {
    background: #f44336;
}

.ct-message-warning {
    background: #ff9800;
}

.ct-message-info {
    background: #2196F3;
}

/* ===== 尺寸指南样式 ===== */
.ct-size-guide-link {
    text-align: center;
    margin-top: 20px;
}

.ct-size-guide-link a {
    color: #2196F3;
    text-decoration: none;
    font-size: 14px;
}

.ct-size-guide-link a:hover {
    text-decoration: underline;
}

.ct-size-guide-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.ct-size-guide-header h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
}

.ct-measurement-diagram {
    text-align: center;
    margin: 20px 0;
}

.ct-measurement-diagram img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.ct-measurement-instructions {
    margin: 20px 0;
}

.ct-measurement-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ct-measurement-item {
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #2196F3;
}

.ct-size-chart {
    margin-top: 30px;
}

.ct-size-chart h4 {
    margin-bottom: 15px;
    color: #333;
}

.ct-size-chart-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.ct-size-chart-table th,
.ct-size-chart-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.ct-size-chart-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.ct-size-chart-table tbody tr:hover {
    background: #f8f9fa;
}

/* ===== 动画效果 ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .ct-designer-main {
        flex-direction: column;
        gap: 20px;
    }
    
    .ct-options-panel {
        max-width: 100%;
    }
    
    .ct-preview-panel {
        flex: none;
        position: static;
    }
    
    .ct-progress-steps {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .ct-progress-step:not(:last-child)::after {
        display: none;
    }
    
    .ct-fabric-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .ct-style-options {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .ct-measurement-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ct-navigation-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .ct-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .ct-size-tabs {
        flex-direction: column;
    }
    
    .ct-size-tab {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .ct-size-tab:last-child {
        border-bottom: none;
    }
    
    .ct-fabric-filters {
        flex-direction: column;
        gap: 15px;
    }
    
    .ct-summary-fabric {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .ct-message {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .ct-designer-container {
        padding: 15px;
        margin: 10px;
    }
    
    .ct-fabric-grid {
        grid-template-columns: 1fr;
    }
    
    .ct-style-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ct-standard-sizes {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ct-step-header h3 {
        font-size: 20px;
    }
    
    .ct-step-header p {
        font-size: 14px;
    }
}