/* ===== スポーツ大会管理システム - カスタムスタイル ===== */

/* ----- グローバル設定 ----- */
:root {
    --primary-color: #ff6b35;
    --primary-dark: #e85a2a;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --accent-color: #ff8c42;
    --border-radius: 8px;
    --box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    --box-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f0f2f5;
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ----- ナビゲーションバー ----- */
.navbar {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.nav-link {
    font-weight: 500;
    transition: var(--transition);
    border-radius: 8px;
    margin: 0 4px;
    padding: 8px 16px !important;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* ----- セクションヘッダー ----- */
.section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.section-header p {
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* ----- カード共通スタイル ----- */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--box-shadow-hover);
    transform: translateY(-2px);
}

.card-header {
    background-color: white;
    border-bottom: 2px solid var(--light-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* ----- 試合カードスタイル ----- */
.match-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    margin-bottom: 1rem;
    overflow: hidden;
}

.match-card:hover {
    box-shadow: var(--box-shadow-hover);
    transform: translateY(-3px);
}

.match-card-header {
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.match-type-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.25);
}

.match-card-body {
    padding: 1.5rem;
}

.match-teams {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.match-team {
    flex: 1;
    text-align: center;
}

.match-team-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.match-team-score {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
}

.match-vs {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary-color);
    padding: 0 0.5rem;
}

.match-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--light-color);
    font-size: 0.9rem;
    color: var(--secondary-color);
}

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

/* ----- ステータスバッジ ----- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.status-scheduled {
    background-color: #e7f1ff;
    color: #0d6efd;
}

.status-live {
    background-color: #fff3cd;
    color: #856404;
    animation: pulse 2s infinite;
}

.status-finished {
    background-color: #d1e7dd;
    color: #0a3622;
}

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

/* ----- トーナメントブラケット ----- */
.tournament-container {
    overflow-x: auto;
    padding: 2rem 1rem;
}

.tournament-bracket {
    display: grid;
    gap: 3rem;
    min-width: max-content;
    padding: 1rem;
}

.tournament-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 2rem;
    min-width: 280px;
}

.tournament-round-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, rgba(255, 140, 66, 0.1) 100%);
    border-radius: 8px;
}

.tournament-match {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: var(--transition);
}

.tournament-match:hover {
    box-shadow: var(--box-shadow-hover);
    transform: scale(1.02);
}

.tournament-team {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    border-bottom: 1px solid var(--light-color);
}

.tournament-team:last-child {
    border-bottom: none;
}

.tournament-team.winner {
    background: linear-gradient(90deg, rgba(255, 107, 53, 0.1) 0%, transparent 100%);
    font-weight: 700;
}

.tournament-team-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-color);
}

.tournament-team-score {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    min-width: 40px;
    text-align: center;
}

.tournament-team-tbd {
    color: var(--secondary-color);
    font-style: italic;
    opacity: 0.6;
}

/* ----- 順位表 ----- */
.standings-group {
    margin-bottom: 2rem;
}

.standings-group-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, rgba(255, 140, 66, 0.1) 100%);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.standings-table {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.standings-table table {
    margin-bottom: 0;
}

.standings-table th {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    color: white;
    font-weight: 600;
    text-align: center;
    padding: 1rem 0.75rem;
    border: none;
    font-size: 0.9rem;
}

.standings-table td {
    text-align: center;
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-color: var(--light-color);
}

.standings-table tbody tr {
    transition: var(--transition);
}

.standings-table tbody tr:hover {
    background-color: rgba(255, 107, 53, 0.05);
}

.standings-rank {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.standings-team-name {
    font-weight: 600;
    text-align: left !important;
    color: var(--dark-color);
}

.standings-rank-1 {
    color: #ffd700;
}

.standings-rank-2 {
    color: #c0c0c0;
}

.standings-rank-3 {
    color: #cd7f32;
}

/* ----- 管理者モード ----- */
.admin-match-card {
    position: relative;
}

.admin-edit-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

/* ----- モーダル ----- */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* ----- レスポンシブ対応 ----- */
@media (max-width: 768px) {
    .section-header h2 {
        font-size: 1.5rem;
    }

    .match-teams {
        flex-direction: column;
        gap: 0.5rem;
    }

    .match-vs {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }

    .tournament-bracket {
        grid-auto-flow: column;
    }

    .tournament-round {
        min-width: 250px;
    }

    .match-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .standings-table {
        font-size: 0.85rem;
    }

    .standings-table th,
    .standings-table td {
        padding: 0.75rem 0.5rem;
    }
}

/* ----- ユーティリティクラス ----- */
.text-gradient {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
}

.shadow-custom {
    box-shadow: var(--box-shadow);
}

.shadow-custom-hover {
    box-shadow: var(--box-shadow-hover);
}

/* ----- ローディング & エラー画面 ----- */
#loading-screen,
#error-screen {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ----- フッター ----- */
footer {
    margin-top: auto;
}

/* ----- トースト通知 ----- */
.toast {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-hover);
}

.toast-header {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    color: white;
}

.toast-header .btn-close {
    filter: brightness(0) invert(1);
}

/* ----- アニメーション ----- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-content {
    animation: fadeIn 0.4s ease;
}

/* ----- スクロールバーカスタマイズ ----- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ----- プリントスタイル ----- */
@media print {
    .navbar,
    footer,
    .btn,
    .admin-edit-btn {
        display: none !important;
    }

    .card,
    .match-card,
    .tournament-match {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
