/* ========================
   Wage Graph Reader v2 CSS
   Complete Edition
   ======================== */

.wgr-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: 'Noto Sans JP', sans-serif;
}

.wgr-container * {
    box-sizing: border-box;
}

/* Cards */
.wgr-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.wgr-card-header {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.5rem;
}

.wgr-card-desc {
    color: #6b7280;
    margin: 0;
}

/* Buttons */
.wgr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-family: inherit;
    gap: 0.5rem;
}

.wgr-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

.wgr-btn-primary { background: #3b82f6; color: #fff; }
.wgr-btn-primary:hover:not(:disabled) { background: #2563eb; }

.wgr-btn-success { background: #10b981; color: #fff; }
.wgr-btn-success:hover:not(:disabled) { background: #059669; }

.wgr-btn-ai { background: linear-gradient(135deg, #f97316, #ef4444); color: #fff; }
.wgr-btn-ai:hover:not(:disabled) { background: linear-gradient(135deg, #ea580c, #dc2626); }

.wgr-btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.wgr-btn-secondary:hover:not(:disabled) { background: #e5e7eb; }

.wgr-btn-danger { background: #fef2f2; color: #ef4444; border: 1px solid #fecaca; }
.wgr-btn-danger:hover:not(:disabled) { background: #fee2e2; }

.wgr-btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }
.wgr-btn-full { width: 100%; }
.wgr-btn-lg { padding: 1rem 2rem; font-size: 1.1rem; }

/* Grid */
.wgr-grid {
    display: grid;
    gap: 1.5rem;
}

.wgr-grid-main {
    grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
    .wgr-grid-main {
        grid-template-columns: 3fr 1fr;
    }
}

.wgr-grid-2 { grid-template-columns: 1fr 1fr; }

/* Steps */
.wgr-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.wgr-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wgr-step-num {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.wgr-step-num.active { background: #3b82f6; color: #fff; }
.wgr-step-num.complete { background: #10b981; color: #fff; }
.wgr-step-num.inactive { background: #e5e7eb; color: #9ca3af; }

.wgr-step-label { font-weight: 500; font-size: 0.9rem; }
.wgr-step-label.active { color: #111827; }
.wgr-step-label.inactive { color: #9ca3af; }

.wgr-step-line {
    width: 2.5rem;
    height: 2px;
    background: #e5e7eb;
}

@media (max-width: 640px) {
    .wgr-step-line { display: none; }
}

/* Upload */
.wgr-upload {
    text-align: center;
    padding: 4rem 2rem;
}

.wgr-upload-icon {
    width: 5rem;
    height: 5rem;
    margin: 0 auto 1rem;
    color: #9ca3af;
}

/* Alerts */
.wgr-alert {
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.wgr-alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; }
.wgr-alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.wgr-alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.wgr-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Image container */
.wgr-image-area {
    position: relative;
    display: inline-block;
    cursor: crosshair;
    user-select: none;
}

.wgr-image-area img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Markers */
.wgr-corner-marker {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #3b82f6;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    z-index: 100;
    pointer-events: none;
}

.wgr-graph-frame {
    position: absolute;
    border: 2px dashed #3b82f6;
    pointer-events: none;
    z-index: 50;
}

.wgr-trace-point {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 1.5px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    pointer-events: none;
    z-index: 80;
}

/* Plot points (interactive - for plot mode) */
.wgr-plot-point {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 90;
}

.wgr-plot-point:hover {
    transform: translate(-50%, -50%) scale(1.3);
}

/* Coordinate display */
.wgr-coord-bar {
    padding: 0.75rem 1rem;
    background: linear-gradient(to right, #eff6ff, #f0fdf4);
    border: 1px solid #bfdbfe;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.wgr-coord-value {
    font-size: 1.1rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

.wgr-coord-age { color: #2563eb; }
.wgr-coord-wage { color: #059669; }

/* Mode toggle */
.wgr-modes {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.wgr-mode-btn {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    background: #fff;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.2s;
    text-align: center;
}

.wgr-mode-btn:hover { border-color: #3b82f6; }

.wgr-mode-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* Form inputs */
.wgr-input, .wgr-select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-family: inherit;
}

.wgr-input:focus, .wgr-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.wgr-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

/* Line items */
.wgr-line-item {
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.wgr-line-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.wgr-line-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wgr-line-name {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 500;
}

.wgr-line-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Checkbox items */
.wgr-checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.4rem;
    cursor: pointer;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    gap: 0.4rem;
}

.wgr-checkbox-item:hover { background: #f9fafb; }

.wgr-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Progress */
.wgr-progress-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.wgr-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    transition: width 0.3s;
}

/* Spinner */
.wgr-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: wgr-spin 0.8s linear infinite;
}

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

/* Data table */
.wgr-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.wgr-data-table th, .wgr-data-table td {
    padding: 0.4rem 0.6rem;
    border: 1px solid #e5e7eb;
    text-align: right;
}

.wgr-data-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    position: sticky;
    top: 0;
}

/* Scrollable */
.wgr-scrollable {
    max-height: 400px;
    overflow-y: auto;
}

/* Badge */
.wgr-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.wgr-badge-green { background: #dcfce7; color: #166534; }
.wgr-badge-blue { background: #dbeafe; color: #1e40af; }
.wgr-badge-orange { background: #ffedd5; color: #9a3412; }

/* Selection boxes (exclusion / target areas) */
.wgr-selection-box {
    position: absolute;
    border: 3px solid;
    pointer-events: none;
    z-index: 60;
}

.wgr-exclusion-box {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.wgr-target-box {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

/* Tooltip */
.wgr-tooltip {
    position: fixed;
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* AI Status indicator */
.wgr-ai-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.wgr-ai-status.ready { background: #f0fdf4; color: #166534; }
.wgr-ai-status.missing { background: #fef2f2; color: #991b1b; }

.wgr-ai-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.wgr-ai-dot.ready { background: #22c55e; }
.wgr-ai-dot.missing { background: #ef4444; }

/* Utility */
.wgr-flex { display: flex; }
.wgr-flex-between { justify-content: space-between; }
.wgr-flex-center { align-items: center; }
.wgr-flex-col { flex-direction: column; }
.wgr-gap-1 { gap: 0.25rem; }
.wgr-gap-2 { gap: 0.5rem; }
.wgr-gap-3 { gap: 0.75rem; }
.wgr-text-center { text-align: center; }
.wgr-text-sm { font-size: 0.875rem; }
.wgr-text-xs { font-size: 0.75rem; }
.wgr-text-muted { color: #6b7280; }
.wgr-font-bold { font-weight: 700; }
.wgr-mb-2 { margin-bottom: 0.5rem; }
.wgr-mb-3 { margin-bottom: 0.75rem; }
.wgr-mb-4 { margin-bottom: 1rem; }
.wgr-mt-2 { margin-top: 0.5rem; }
.wgr-mt-3 { margin-top: 0.75rem; }
.wgr-hidden { display: none; }
.wgr-w-full { width: 100%; }
