/**
 * BoltCircleCalculator.css
 * 螺絲孔圓座標計算器專用樣式
 *
 * ⚠️ 重要：此檔案只包含計算器專用樣式
 * 以下全域類別已在 layout.css 定義，請勿重新定義：
 * - .glass-card, .form-input, .btn-custom, .btn-sponsor
 * - .page-header, .main-container, .seo-section
 */

/* ===== 座標表格樣式 ===== */
.coordinate-table-wrapper {
    overflow-x: auto;
    margin: 15px 0;
}

.coordinate-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
}

.coordinate-table th,
.coordinate-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.coordinate-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-family: 'Noto Sans TC', sans-serif;
}

.coordinate-table tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

/* 第一列高亮（用 class 控制，非 :first-child） */
.coordinate-table tr.first-row td {
    background-color: rgba(239, 68, 68, 0.1);
}

.coordinate-table tr.first-row td:first-child {
    color: #ef4444;
    font-weight: 700;
}

/* 選中列高亮 */
.coordinate-table tr.selected-row td {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    font-weight: 600;
}

/* ===== G-code 顯示區 ===== */
.gcode-container {
    background: #1a202c;
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    position: relative;
}

.gcode-output {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
    color: #68d391;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.6;
}

.gcode-output .comment {
    color: #718096;
}

.gcode-output .gcode {
    color: #63b3ed;
}

.gcode-output .coordinate {
    color: #f6e05e;
}

.gcode-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.gcode-buttons .btn {
    flex: 1;
    min-width: 120px;
}

/* ===== 孔位預覽圖 ===== */
.preview-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    aspect-ratio: 1;
}

.preview-svg {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

/* SVG 元素樣式 */
.preview-svg .axis-line {
    stroke: #cbd5e0;
    stroke-width: 1;
    stroke-dasharray: 5, 5;
}

.preview-svg .pcd-circle {
    fill: none;
    stroke: #667eea;
    stroke-width: 2;
    stroke-dasharray: 8, 4;
}

.preview-svg .hole-marker {
    fill: #667eea;
    stroke: white;
    stroke-width: 2;
    cursor: pointer;
    transition: fill 0.2s ease;
}

.preview-svg .hole-marker:hover {
    fill: #764ba2;
}

.preview-svg .hole-marker.first-hole {
    fill: #ef4444;
}

.preview-svg .hole-marker.selected-hole {
    fill: #ef4444;
    stroke: #b91c1c;
    stroke-width: 3;
}

.preview-svg .hole-label {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    fill: #4a5568;
    text-anchor: middle;
    pointer-events: none;
}

.preview-svg .center-marker {
    fill: none;
    stroke: #718096;
    stroke-width: 2;
}

.preview-svg .dimension-text {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 12px;
    fill: #667eea;
}

.preview-note {
    text-align: center;
    font-size: 0.85rem;
    color: #718096;
    margin-top: 10px;
}

/* ===== 結果卡片樣式 ===== */
.result-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    margin-bottom: 20px;
}

.result-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.result-summary-item:last-child {
    border-bottom: none;
}

.result-summary-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.result-summary-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ===== G-code 參數輸入 ===== */
.gcode-params {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

@media (max-width: 767px) {
    .gcode-params {
        grid-template-columns: 1fr;
    }
}

.gcode-param-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.gcode-param-group .form-input {
    width: 100%;
    box-sizing: border-box;
}

.gcode-param-label {
    font-size: 0.85rem;
    color: #4a5568;
    font-weight: 500;
}

/* ===== 輸入區域佈局 ===== */
.input-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.input-row > .input-group-custom {
    flex: 1;
}

@media (max-width: 767px) {
    .input-row {
        flex-direction: column;
        gap: 15px;
    }
}

.input-group-custom {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #2d3748;
    font-size: 0.95rem;
}

.input-label i {
    color: #667eea;
    width: 16px;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.input-wrapper .form-input {
    width: 100%;
    box-sizing: border-box;
}

.input-range {
    font-size: 0.75rem;
    color: #a0aec0;
    margin-top: 4px;
    text-align: left;
}

/* ===== Tooltip 樣式 ===== */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #e2e8f0;
    border-radius: 50%;
    font-size: 0.7rem;
    color: #4a5568;
    cursor: help;
    position: relative;
    font-weight: 700;
}

.tooltip-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a202c;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 400;
    white-space: nowrap;
    z-index: 100;
    transition: all 0.2s ease;
    max-width: 250px;
    white-space: normal;
    text-align: left;
}

.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1a202c;
}

/* ===== 複製成功提示 ===== */
.copy-success {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #48bb78;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 9999;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ===== 響應式調整 ===== */
@media (max-width: 991px) {
    .preview-container {
        max-width: 300px;
    }
}

@media (max-width: 767px) {
    .coordinate-table th,
    .coordinate-table td {
        padding: 8px 6px;
        font-size: 0.85rem;
    }

    .gcode-output {
        font-size: 0.75rem;
        max-height: 200px;
    }

    .result-summary {
        padding: 15px;
    }

    .result-summary-value {
        font-size: 1rem;
    }
}

/* ===== 列印樣式 ===== */
@media print {
    .preview-svg {
        border: 1px solid #000;
    }

    .coordinate-table th {
        background: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .gcode-container {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .gcode-output {
        color: #000 !important;
    }
}
