/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* メインコンテンツ */
main {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* 情報ボックス */
.info-box {
    background-color: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.info-box p {
    margin-bottom: 8px;
}

.info-box p:last-child {
    margin-bottom: 0;
}

.info-box strong {
    color: #1976d2;
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
}

/* セクション共通スタイル */
section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.5rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* フォームスタイル */
.create-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.create-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.create-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.create-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

/* ステータスメッセージ */
.status-message {
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    font-weight: 500;
}

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

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

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

.status-message.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* サンドボックス一覧 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
}

.stop-all-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.stop-all-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.4);
}

.stop-all-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.stop-all-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sandboxes-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sandbox-item {
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    transition: all 0.3s ease;
}

.sandbox-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.sandbox-item-starting {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #f39c12;
    position: relative;
    overflow: hidden;
}

.sandbox-item-starting::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

.sandbox-item-starting .detail-value {
    color: #856404;
}

.sandbox-item-running {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #f39c12;
    position: relative;
    overflow: hidden;
}

.sandbox-item-running::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: shimmer 1.5s infinite;
}

.sandbox-item-running .detail-value {
    color: #856404;
}

/* キラキラ効果 */
.sparkle-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 30px, #fff, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: sparkle 3s linear infinite;
    pointer-events: none;
    opacity: 0.7;
}

@keyframes sparkle {
    0% { transform: translateX(0); }
    100% { transform: translateX(200px); }
}

.sandbox-item-ready {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 2px solid #28a745;
}

.sandbox-item-ready .detail-value {
    color: #155724;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.sandbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.sandbox-id {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

.sandbox-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-starting {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: status-pulse 2s ease-in-out infinite;
}

.status-running {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: status-pulse 1.5s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

.status-stopped {
    background-color: #f8d7da;
    color: #721c24;
}

.status-error {
    background-color: #f8d7da;
    color: #721c24;
}

.sandbox-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 2px;
}

.detail-value {
    font-weight: 500;
    color: #333;
}

.detail-value a {
    color: #3498db;
    text-decoration: none;
}

.detail-value a:hover {
    text-decoration: underline;
}

.sandbox-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.sandbox-link:hover {
    text-decoration: underline;
}

.sandbox-link-active {
    color: #2980b9;
    font-weight: 600;
}

.sandbox-link-active:hover {
    color: #1f5f8b;
    text-decoration: underline;
}

.sandbox-link-disabled {
    color: #95a5a6;
    font-style: italic;
    cursor: not-allowed;
    pointer-events: none;
}

.sandbox-link-creating {
    animation: creating-pulse 1.5s ease-in-out infinite;
}

.sandbox-link-preparing {
    animation: preparing-pulse 2s ease-in-out infinite;
}

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

.sandbox-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stop-btn {
    background-color: #e74c3c;
    color: white;
}

.stop-btn:hover:not(:disabled) {
    background-color: #c0392b;
}

.stop-btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* カウントダウン */
.countdown {
    font-weight: 600;
    color: #e67e22;
}

.countdown.urgent {
    color: #e74c3c;
    animation: pulse 1s infinite;
}

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

/* ローディング */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* スピナー */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

.starting-spinner {
    border: 3px solid rgba(243, 156, 18, 0.3);
    border-top: 3px solid #f39c12;
    animation: spin 1s linear infinite;
}

.running-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #ffffff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 全画面ローディングオーバーレイ */
.fullscreen-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.fullscreen-loading-content {
    text-align: center;
    color: white;
    padding: 40px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.large-loading-spinner {
    display: inline-block;
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top: 6px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-message {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: white;
}

.loading-submessage {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

/* 作成中テキストのアニメーション */
.creating-text {
    animation: creating-pulse 1.5s ease-in-out infinite;
    color: #856404;
}

.running-text {
    animation: running-pulse 1.2s ease-in-out infinite;
    color: white;
}

.preparing-text {
    animation: preparing-pulse 2s ease-in-out infinite;
    color: #856404;
    font-style: italic;
}

.ready-text {
    color: #155724;
    font-weight: 600;
}

.stopped-text {
    color: #721c24;
}

.error-text {
    color: #721c24;
}

@keyframes creating-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

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

.status-message.info {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* コピーボタン */
.copy-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 50px;
}

.copy-btn:hover {
    background: #2980b9;
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn.copied {
    background: #27ae60;
}

.copy-btn.copied:hover {
    background: #229954;
}

/* サンドボックスなしメッセージ */
.no-sandboxes-message {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px dashed #dee2e6;
    margin: 20px 0;
}

.no-sandboxes-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.7;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.no-sandboxes-message h3 {
    font-size: 1.5rem;
    color: #495057;
    margin-bottom: 15px;
    font-weight: 600;
}

.no-sandboxes-message p {
    font-size: 1.1rem;
    color: #6c757d;
    margin: 0;
    line-height: 1.6;
}

.no-sandboxes {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* フッター */
footer {
    text-align: center;
    padding: 20px;
    color: #666;
    border-top: 1px solid #eee;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    section {
        padding: 20px;
    }
    
    .sandbox-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .sandbox-details {
        grid-template-columns: 1fr;
    }
    
    .sandbox-actions {
        flex-direction: column;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .stop-all-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .no-sandboxes-message {
        padding: 40px 20px;
    }
    
    .no-sandboxes-icon {
        font-size: 3rem;
    }
    
    .no-sandboxes-message h3 {
        font-size: 1.3rem;
    }
    
    .no-sandboxes-message p {
        font-size: 1rem;
    }
}