/* Hoshin Kanri X-Matrix Styles (Phase 12.2) */

.hoshin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
}

.hoshin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.hoshin-header h2 {
    font-size: 22px;
    color: #1d1d1f;
    margin: 0;
}

.hoshin-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hoshin-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hoshin-btn-primary {
    background: linear-gradient(135deg, #2d5aa0, #1a73e8);
    color: white;
}

.hoshin-btn-primary:hover { opacity: 0.9; }

.hoshin-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.hoshin-btn-secondary:hover { background: #e5e7eb; }

.hoshin-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Matrix List */
.hoshin-list {
    display: grid;
    gap: 12px;
}

.hoshin-list-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 16px;
}

.hoshin-list-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.hoshin-list-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.hoshin-list-info {
    flex: 1;
    min-width: 0;
}

.hoshin-list-title {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.hoshin-list-meta {
    font-size: 12px;
    color: #6e6e73;
}

.hoshin-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.hoshin-status-draft { background: #f3f4f6; color: #6b7280; }
.hoshin-status-active { background: #dbeafe; color: #1d4ed8; }
.hoshin-status-review { background: #fef3c7; color: #92400e; }
.hoshin-status-archived { background: #e5e7eb; color: #4b5563; }

/* ==================== */
/* X-Matrix Visual Layout */
/* ==================== */

.xmatrix-wrapper {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.xmatrix-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #2d5aa0, #1a73e8);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.xmatrix-title {
    font-size: 18px;
    font-weight: 700;
}

.xmatrix-year {
    font-size: 13px;
    opacity: 0.85;
}

/* Grid layout: center cross with 4 quadrant lists */
.xmatrix-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto auto auto;
    min-height: 500px;
}

/* Top quadrant - Strategic Goals */
.xmatrix-top {
    grid-column: 1 / -1;
    border-bottom: 2px solid #2d5aa0;
    padding: 16px 20px;
    background: #eff6ff;
}

/* Left quadrant - Annual Goals */
.xmatrix-left {
    border-right: 2px solid #2d5aa0;
    padding: 16px 20px;
    background: #f0fdf4;
}

/* Center - Correlation matrix */
.xmatrix-center {
    min-width: 200px;
    min-height: 200px;
    position: relative;
    background: #fafafa;
    padding: 4px;
}

/* Right quadrant - KPI / Targets */
.xmatrix-right {
    border-left: 2px solid #2d5aa0;
    padding: 16px 20px;
    background: #fef2f2;
}

/* Bottom quadrant - Projects */
.xmatrix-bottom {
    grid-column: 1 / -1;
    border-top: 2px solid #2d5aa0;
    padding: 16px 20px;
    background: #fffbeb;
}

/* Quadrant common styles */
.xmatrix-quadrant-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.xmatrix-add-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px dashed #9ca3af;
    background: white;
    color: #6b7280;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.xmatrix-add-btn:hover {
    background: #2d5aa0;
    color: white;
    border-color: #2d5aa0;
}

/* Items in quadrants */
.xmatrix-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.xmatrix-top .xmatrix-items,
.xmatrix-bottom .xmatrix-items {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.xmatrix-item {
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    font-size: 13px;
    color: #1d1d1f;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.xmatrix-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #2d5aa0;
}

.xmatrix-item.selected {
    border-color: #2d5aa0;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(45,90,160,0.2);
}

.xmatrix-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.xmatrix-item-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xmatrix-item-delete {
    opacity: 0;
    font-size: 12px;
    color: #9ca3af;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.xmatrix-item:hover .xmatrix-item-delete {
    opacity: 1;
}

.xmatrix-item-delete:hover {
    color: #e53e3e;
}

/* Color assignments */
.xmatrix-top .xmatrix-item-dot { background: #2d5aa0; }
.xmatrix-left .xmatrix-item-dot { background: #059669; }
.xmatrix-right .xmatrix-item-dot { background: #dc2626; }
.xmatrix-bottom .xmatrix-item-dot { background: #d97706; }

/* Correlation dots in center */
.xmatrix-corr-grid {
    display: grid;
    gap: 2px;
}

.xmatrix-corr-cell {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 3px;
    font-size: 10px;
    transition: background 0.15s;
}

.xmatrix-corr-cell:hover {
    background: #e5e7eb;
}

.xmatrix-corr-strong { color: #1d4ed8; font-size: 14px; }
.xmatrix-corr-medium { color: #6b7280; font-size: 12px; }
.xmatrix-corr-weak { color: #9ca3af; font-size: 12px; }

/* Footer */
.xmatrix-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.xmatrix-legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #6b7280;
}

.xmatrix-legend span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Item add modal */
.hoshin-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hoshin-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.hoshin-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hoshin-modal-body {
    padding: 20px;
}

.hoshin-modal-body label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.hoshin-modal-body input,
.hoshin-modal-body textarea,
.hoshin-modal-body select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 12px;
}

.hoshin-modal-body textarea {
    min-height: 60px;
    resize: vertical;
}

.hoshin-modal-body input:focus,
.hoshin-modal-body textarea:focus,
.hoshin-modal-body select:focus {
    outline: none;
    border-color: #2d5aa0;
    box-shadow: 0 0 0 3px rgba(45,90,160,0.15);
}

.hoshin-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .xmatrix-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .xmatrix-top, .xmatrix-left, .xmatrix-center,
    .xmatrix-right, .xmatrix-bottom {
        grid-column: 1;
        border: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .xmatrix-center {
        display: none;
    }

    .hoshin-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Print */
@media print {
    .hoshin-btn, .hoshin-header-actions, .xmatrix-footer,
    .xmatrix-add-btn, .xmatrix-item-delete { display: none !important; }
    .xmatrix-wrapper { border: none; box-shadow: none; }
}
