/**
 * 🎬 シナリオスタジオ専用スタイル
 */

/* メインレイアウト（共通レイアウト対応） */
.scenario-studio-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px);
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: #f8f9fa;
}

.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.studio-header h2 {
    margin: 0;
    color: #495057;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.studio-content {
    display: grid;
    grid-template-columns: 300px 1fr 320px;
    gap: 1rem;
    padding: 1rem;
    flex: 1;
    overflow: hidden;
}

/* パネル共通 */
.left-panel, .center-panel, .right-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.panel-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #495057;
}

/* 左パネル: シナリオ一覧 */
.scenario-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.scenario-item {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scenario-item:hover {
    border-color: #007bff;
    background: #f8f9ff;
}

.scenario-item.selected {
    border-color: #007bff;
    background: #e3f2fd;
}

.scenario-item.recent {
    border-left: 4px solid #28a745;
    background: linear-gradient(90deg, #f8fff9 0%, #ffffff 100%);
}

.scenario-item.recent.selected {
    border-left: 4px solid #28a745;
    background: linear-gradient(90deg, #e8f5e8 0%, #e3f2fd 100%);
}

.scenario-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.scenario-icon {
    font-size: 1.2rem;
}

.scenario-info {
    flex: 1;
}

.scenario-name {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.scenario-type {
    font-size: 0.75rem;
    color: #6c757d;
}

.scenario-status {
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
}

.scenario-status.draft {
    background: #fff3cd;
    color: #856404;
}

.scenario-status.published {
    background: #d4edda;
    color: #155724;
}

.recent-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    background: #28a745;
    color: white;
    margin-left: 0.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.scenario-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.scenario-meta small {
    color: #6c757d;
    font-size: 0.7rem;
}

.scenario-actions {
    display: flex;
    gap: 0.25rem;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

/* 中央パネル: フェーズエディター */
.phase-editor {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.no-scenario-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    font-style: italic;
}

.phases-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.phase-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.phase-header {
    padding: 0.75rem;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.phase-info h5 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    color: #495057;
}

.phase-info p {
    margin: 0;
    font-size: 0.8rem;
    color: #6c757d;
}

.phase-order {
    background: #007bff;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.phase-content {
    padding: 1rem;
}

.element-group {
    margin-bottom: 1rem;
}

.element-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.option-item.correct {
    border-left: 3px solid #28a745;
    padding-left: 0.5rem;
}

.option-item.incorrect {
    border-left: 3px solid #dc3545;
    padding-left: 0.5rem;
}

/* 右パネル: プレビュー */
.preview-panel {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.preview-content h5 {
    margin: 0 0 0.5rem 0;
    color: #495057;
}

.scenario-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 1rem 0;
}

.stat-item {
    text-align: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 600;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: #495057;
}

.phase-flow h6 {
    margin: 1rem 0 0.5rem 0;
    color: #495057;
    font-size: 0.9rem;
}

.flow-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.flow-order {
    width: 24px;
    height: 24px;
    background: #6c757d;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.flow-name {
    font-size: 0.8rem;
    color: #495057;
}

/* モーダル */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.modal-header h4 {
    margin: 0;
    color: #495057;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
}

.form-control, .form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: #007bff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ボタン */
.btn {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    margin-bottom: 0;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #004085;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #545b62;
    border-color: #4e555b;
}

.btn-success {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #1e7e34;
    border-color: #1c7430;
}

.btn-info {
    color: #fff;
    background-color: #17a2b8;
    border-color: #17a2b8;
}

.btn-info:hover {
    background-color: #117a8b;
    border-color: #10707f;
}

.btn-warning {
    color: #212529;
    background-color: #ffc107;
    border-color: #ffc107;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

.btn-outline-primary {
    color: #007bff;
    border-color: #007bff;
    background-color: transparent;
}

.btn-outline-primary:hover {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
    background-color: transparent;
}

.btn-outline-secondary:hover {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-success {
    color: #28a745;
    border-color: #28a745;
    background-color: transparent;
}

.btn-outline-success:hover {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}

.btn-outline-warning {
    color: #ffc107;
    border-color: #ffc107;
    background-color: transparent;
}

.btn-outline-warning:hover {
    color: #212529;
    background-color: #ffc107;
    border-color: #ffc107;
}

.btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
    background-color: transparent;
}

.btn-outline-danger:hover {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 3px;
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* 通知スタイル */
.notification {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1000;
    min-width: 300px;
    max-width: 500px;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.3s ease-out;
}

.notification-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.notification-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.notification-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.notification-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.notification-message {
    flex: 1;
    font-size: 0.9rem;
    margin-right: 10px;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    color: inherit;
    opacity: 0.7;
}

.notification-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* レスポンシブ */
@media (max-width: 1200px) {
    .studio-content {
        grid-template-columns: 280px 1fr 300px;
    }
}

@media (max-width: 992px) {
    .studio-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .left-panel, .right-panel {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .studio-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .studio-content {
        padding: 0.5rem;
        gap: 0.5rem;
    }
}
