/* ============================================
   Soccer Tournament Manager - Advanced Styles
   ============================================ */

:root {
    /* Color Palette - Samurai Blue (Japan National Team) */
    --primary: #0033A0;
    --primary-light: #0066CC;
    --primary-dark: #00205B;
    --secondary: #10b981;
    --secondary-light: #34d399;
    --accent: #f59e0b;
    --accent-light: #fbbf24;

    /* Status Colors */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Gradients - Samurai Blue */
    --gradient-primary: linear-gradient(135deg, #00205B 0%, #0033A0 50%, #0066CC 100%);
    --gradient-secondary: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
}

/* ============================================
   Dark Theme (Default)
   ============================================ */
:root,
[data-theme="dark"] {
    /* Background Colors */
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-card-hover: rgba(51, 65, 85, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-navbar: rgba(15, 23, 42, 0.9);

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(0, 51, 160, 0.4);
    --shadow-glow-success: 0 0 20px rgba(34, 197, 94, 0.3);

    /* Gradients */
    --gradient-dark: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);

    /* Hero & CTA Overlays - Dark mode (lighter overlay) */
    --hero-overlay: linear-gradient(rgba(0, 10, 30, 0.35), rgba(0, 10, 30, 0.45));
    --cta-overlay: linear-gradient(rgba(0, 20, 50, 0.5), rgba(0, 51, 160, 0.6));

    /* Border */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-color-hover: rgba(255, 255, 255, 0.2);

    /* Form Select Arrow */
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

/* ============================================
   Light Theme
   ============================================ */
[data-theme="light"] {
    /* Background Colors */
    --bg-dark: #f1f5f9;
    --bg-darker: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(241, 245, 249, 0.95);
    --bg-glass: rgba(0, 0, 0, 0.03);
    --bg-navbar: rgba(255, 255, 255, 0.95);

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(0, 51, 160, 0.25);
    --shadow-glow-success: 0 0 20px rgba(34, 197, 94, 0.15);

    /* Gradients */
    --gradient-dark: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    --gradient-glass: linear-gradient(135deg, rgba(0,0,0,0.02) 0%, rgba(0,0,0,0.05) 100%);

    /* Hero & CTA Overlays - Light mode (stronger overlay for text readability) */
    --hero-overlay: linear-gradient(rgba(0, 20, 60, 0.55), rgba(0, 30, 80, 0.65));
    --cta-overlay: linear-gradient(rgba(0, 51, 160, 0.75), rgba(0, 32, 91, 0.85));

    /* Border */
    --border-color: rgba(0, 0, 0, 0.1);
    --border-color-hover: rgba(0, 0, 0, 0.15);

    /* Form Select Arrow */
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

/* ============================================
   Animations
   ============================================ */

@keyframes bgPulse {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes glow {
    0%, 100% { box-shadow: var(--shadow-glow); }
    50% { box-shadow: 0 0 30px rgba(0, 51, 160, 0.5); }
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================
   Base Styles
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-darker);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
.bg-animated {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(0, 51, 160, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 102, 204, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 50%),
        var(--bg-darker);
    background-size: 200% 200%;
    animation: bgPulse 15s ease infinite;
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-md);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Layout
   ============================================ */

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.page-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    margin-top: 65px;
    padding: 2rem;
    animation: fadeIn 0.5s ease;
}

/* ============================================
   Glass Card
   ============================================ */

.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    transition: all var(--transition-base);
    animation: fadeInUp 0.5s ease;
}

.card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-body {
    padding: var(--space-md) 0;
}

/* ============================================
   Navigation
   ============================================ */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-navbar);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-md) 0;
    animation: slideDown 0.5s ease;
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-brand i {
    color: var(--primary);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    list-style: none;
}

.navbar-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.navbar-link:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.navbar-link.active {
    color: var(--primary-light);
    background: rgba(0, 51, 160, 0.1);
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    position: fixed;
    top: 65px;
    left: 0;
    width: 280px;
    height: calc(100vh - 65px);
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: var(--space-lg);
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    animation: slideIn 0.5s ease;
}

.sidebar::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.sidebar-menu {
    list-style: none;
}

.sidebar-item {
    margin-bottom: var(--space-xs);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
    transform: translateX(5px);
}

.sidebar-link.active {
    color: #ffffff;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-glow);
}

/* ライトモードでもactiveリンクの文字は白 */
[data-theme="light"] .sidebar-link.active {
    color: #ffffff;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: var(--space-lg) 0;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 51, 160, 0.5);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-success {
    background: var(--gradient-secondary);
    color: white;
    box-shadow: var(--shadow-glow-success);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* Hide hamburger menu on PC by default */
#menu-toggle {
    display: none;
}

.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.75rem;
}

.btn-lg {
    padding: var(--space-lg) var(--space-2xl);
    font-size: 1rem;
}

/* ============================================
   Form Elements
   ============================================ */

.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 51, 160, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-select {
    appearance: none;
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* ダークモード時のドロップダウンオプション - 背景白・文字黒 */
.form-select option,
[data-theme="dark"] select option,
select option {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* ダークモード時のselectホバー・選択状態 */
.form-select option:hover,
.form-select option:checked,
[data-theme="dark"] select option:hover,
[data-theme="dark"] select option:checked,
select option:hover,
select option:checked {
    background-color: #e2e8f0 !important;
    color: #000000 !important;
}

/* ============================================
   Theme Toggle
   ============================================ */

.theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.theme-toggle-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.theme-toggle-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-color-hover);
}

.theme-toggle-btn .icon-sun,
.theme-toggle-btn .icon-moon,
.theme-toggle-btn .icon-auto {
    display: none;
}

[data-theme="light"] .theme-toggle-btn .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle-btn .icon-moon { display: block; }
[data-theme="auto"] .theme-toggle-btn .icon-auto { display: block; }

/* Default state (when no explicit theme set, treat as auto) */
html:not([data-theme]) .theme-toggle-btn .icon-auto { display: block; }

/* Theme Dropdown Menu */
.theme-menu {
    position: absolute;
    top: calc(100% + var(--space-sm));
    right: 0;
    background: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-sm);
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 1001;
}

.theme-toggle:hover .theme-menu,
.theme-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: #94a3b8;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    font-size: 0.875rem;
}

.theme-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

.theme-menu-item.active {
    background: var(--gradient-primary);
    color: white;
}

.theme-menu-item i {
    width: 20px;
    text-align: center;
}

/* ライトモード用テーマメニュースタイル */
[data-theme="light"] .theme-menu {
    background: #ffffff;
    border-color: var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .theme-menu-item {
    color: #475569;
}

[data-theme="light"] .theme-menu-item:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
}

[data-theme="light"] .theme-menu-item.active {
    background: var(--gradient-primary);
    color: white;
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.form-check-input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: var(--space-xs);
    animation: slideDown 0.3s ease;
}

/* ============================================
   Tables
   ============================================ */

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table th {
    background: var(--bg-glass);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table tr {
    transition: all var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-glass);
}

.table-striped tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* ============================================
   Standings Table
   ============================================ */

.standings-table {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.standings-table th {
    background: linear-gradient(135deg, rgba(0, 51, 160, 0.2) 0%, rgba(0, 102, 204, 0.1) 100%);
}

.standings-table .rank {
    width: 50px;
    text-align: center;
    font-weight: 700;
}

.standings-table .rank-1 {
    color: #ffd700;
}

.standings-table .rank-2 {
    color: #c0c0c0;
}

.standings-table .rank-3 {
    color: #cd7f32;
}

.standings-table .team-name {
    font-weight: 600;
}

.standings-table .stat {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.standings-table .points {
    font-weight: 700;
    color: var(--primary-light);
}

.advance-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: var(--space-sm);
}

.advance-indicator.qualified {
    background: var(--success);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.advance-indicator.playoff {
    background: var(--warning);
}

/* ============================================
   Tournament Bracket
   ============================================ */

.bracket-container {
    padding: var(--space-xl);
    overflow-x: auto;
}

.bracket {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    min-width: max-content;
    position: relative;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    min-width: 200px;
    flex-shrink: 0;
}

.bracket-matches {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1;
}

.bracket-connector {
    min-width: 60px;
    flex-shrink: 0;
    position: relative;
}

.bracket-round-title {
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.bracket-match {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-fast);
    animation: scaleIn 0.5s ease;
}

.bracket-match:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow);
}

.bracket-team {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-fast);
}

.bracket-team:last-child {
    border-bottom: none;
}

/* トーナメント試合の日時・会場設定 */
.bracket-match-details {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.25rem;
    padding: 0.2rem 0.3rem;
    background: rgba(var(--primary-rgb), 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    align-items: center;
    justify-content: center;
}

.bracket-match-details i {
    color: var(--text-secondary);
    font-size: 0.6rem;
    flex-shrink: 0;
}

.bracket-match-details input[type="datetime-local"] {
    padding: 0.15rem 0.25rem;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.65rem;
    width: 115px;
}

.bracket-match-details select {
    padding: 0.15rem 0.2rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.65rem;
    min-width: 60px;
    max-width: 80px;
}

.bracket-match-details select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.bracket-match-details .btn-xs {
    padding: 0.15rem 0.3rem;
    font-size: 0.6rem;
    flex-shrink: 0;
}

.bracket-team.winner {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.2) 0%, transparent 100%);
}

.bracket-team.winner .team-name {
    color: var(--success);
    font-weight: 600;
}

.bracket-team .team-name {
    flex: 1;
    font-size: 0.875rem;
}

.bracket-team .team-score {
    font-weight: 700;
    min-width: 30px;
    text-align: center;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
}

.bracket-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
}

/* Seed Badge */
.seed-badge {
    font-size: 0.625rem;
    color: var(--text-muted);
    margin-right: var(--space-sm);
    padding: 2px 6px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
}

/* ============================================
   Match Card
   ============================================ */

.match-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    transition: all var(--transition-fast);
}

.match-card:hover {
    background: var(--bg-card-hover);
    transform: translateX(5px);
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
}

.match-team {
    flex: 1;
    text-align: center;
}

.match-team-name {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.match-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
}

.match-score-value {
    font-size: 2rem;
    font-weight: 700;
    min-width: 50px;
    padding: var(--space-sm);
    background: var(--bg-glass);
    border-radius: var(--radius-md);
}

.match-score-separator {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.match-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.match-status.scheduled {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.match-status.live {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    animation: pulse 2s infinite;
}

.match-status.finished {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

/* ============================================
   Alerts & Messages
   ============================================ */

.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    animation: slideDown 0.3s ease;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
}

/* ============================================
   Modal
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: all var(--transition-bounce);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   Loading States
   ============================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-glass);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-glass) 25%, rgba(255, 255, 255, 0.1) 50%, var(--bg-glass) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-sm);
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: var(--space-md);
}

/* ============================================
   Badges & Tags
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: rgba(0, 51, 160, 0.2);
    color: var(--primary-light);
}

.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ============================================
   Stats & Metrics
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    text-align: center;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    font-size: 1.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: var(--space-xs);
}

/* ============================================
   Utilities
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--primary-light); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.gap-1 { gap: var(--space-sm); }
.gap-2 { gap: var(--space-md); }
.gap-3 { gap: var(--space-lg); }

.w-100 { width: 100%; }

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 var(--space-md);
    }

    /* Mobile navbar */
    .navbar-menu {
        display: none;
    }

    #menu-toggle {
        display: flex !important;
    }

    /* Mobile sidebar */
    .sidebar {
        transform: translateX(-100%);
        z-index: 999;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;  /* モバイル: 32px -> 16px */
    }

    /* Sidebar overlay when open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 65px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .card {
        padding: 1rem;  /* モバイル: 24px -> 16px */
    }

    /* Mobile bracket - horizontal scroll instead of vertical stack */
    .bracket-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--space-md);
    }

    .bracket {
        flex-direction: row;
        min-width: max-content;
    }

    .bracket-round {
        min-width: 150px;
    }

    .bracket-match {
        min-width: 140px;
    }

    .bracket-team .team-name {
        font-size: 0.75rem;
        max-width: 80px;
    }

    .match-teams {
        flex-direction: column;
        gap: var(--space-md);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;  /* スマホ: 16px -> 12px */
    }

    .main-content {
        padding: 0.75rem;  /* スマホ: 16px -> 12px */
    }

    .card {
        padding: 0.75rem;  /* スマホ: 16px -> 12px */
        border-radius: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .btn {
        width: 100%;
    }

    /* ヘッダータイトルの余白調整 */
    h1 {
        font-size: 1.5rem;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .bg-animated,
    .navbar,
    .sidebar,
    .btn,
    .modal-overlay,
    .no-print,
    .organizer-comment,
    .related-links-section {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        background: white;
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* ============================================
   Hero & CTA Sections
   ============================================ */

.hero-section {
    position: relative;
    text-align: center;
    padding: 6rem 2rem 4rem;
    background: var(--hero-overlay), url('/assets/images/hero-bg.png') center/cover no-repeat;
    margin: 0 -2rem;
}

.hero-section h1,
.hero-section p {
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.3);
}

.hero-section .btn-secondary {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
    border: none;
}

.hero-section .btn-secondary:hover {
    background: #ffffff;
}

.cta-section {
    position: relative;
    text-align: center;
    padding: 5rem 2rem;
    background: var(--cta-overlay), url('/assets/images/cta-bg-v2.png') center 30%/cover no-repeat;
    margin-top: 2rem;
}

.cta-section h2,
.cta-section p {
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.3);
}

/* Hero/CTA Mobile Optimization */
@media (max-width: 768px) {
    .hero-section {
        padding: 4rem 1rem 3rem;  /* 左右: 32px -> 16px */
        margin: 0 -1rem;
    }

    .cta-section {
        padding: 3rem 1rem;  /* 左右: 32px -> 16px */
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 3rem 0.75rem 2rem;  /* さらに狭く */
        margin: 0 -0.75rem;
    }

    .cta-section {
        padding: 2rem 0.75rem;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }
}

/* ============================================
   Drag & Drop Match Editor
   ============================================ */

.dnd-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

@media (max-width: 768px) {
    .dnd-container {
        grid-template-columns: 1fr;
    }
}

/* Team Pool */
.team-pool {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    position: sticky;
    top: var(--space-lg);
    max-height: 70vh;
    overflow-y: auto;
}

.team-pool-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.team-pool-title i {
    color: var(--primary);
}

.team-pool-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.team-pool-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all var(--transition-fast);
    user-select: none;
}

.team-pool-item:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: translateX(5px);
}

.team-pool-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.team-pool-item.assigned {
    opacity: 0.5;
    color: var(--text-muted);
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
}

.team-pool-item .seed-num {
    font-size: 0.625rem;
    color: var(--text-muted);
    padding: 2px 6px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    min-width: 20px;
    text-align: center;
}

.team-pool-item .team-name {
    flex: 1;
    font-size: 0.875rem;
}

.team-pool-item .assigned-badge {
    font-size: 0.625rem;
    color: var(--success);
    padding: 2px 6px;
    background: rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-sm);
}

/* Match Editor Grid */
.match-editor-grid {
    display: grid;
    gap: var(--space-lg);
}

.match-editor-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    transition: all var(--transition-fast);
}

.match-editor-card:hover {
    background: var(--bg-card-hover);
}

.match-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.match-editor-teams {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.match-editor-vs {
    font-weight: 600;
    color: var(--text-muted);
}

/* Team Dropzone */
.team-dropzone {
    flex: 1;
    min-height: 60px;
    background: var(--bg-glass);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    transition: all var(--transition-fast);
    position: relative;
}

.team-dropzone.dragover {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.team-dropzone.dragover-invalid {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.team-dropzone.has-team {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), transparent);
}

.team-dropzone.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.1);
}

.team-dropzone-placeholder {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.team-dropzone-content {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
}

.team-dropzone-content .team-name {
    flex: 1;
    font-weight: 600;
}

.team-dropzone-content .remove-btn {
    padding: 4px 8px;
    background: rgba(239, 68, 68, 0.2);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--danger);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
}

.team-dropzone:hover .remove-btn {
    opacity: 1;
}

.team-dropzone-content .remove-btn:hover {
    background: rgba(239, 68, 68, 0.4);
}

/* Dragged item ghost */
.team-drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    padding: var(--space-sm) var(--space-md);
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glow);
    font-weight: 600;
    transform: translate(-50%, -50%);
}

/* ============================================
   Result Type Badge (延長戦/PK戦)
   ============================================ */
.result-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(249, 115, 22, 0.2));
    color: var(--accent);
    border: 1px solid rgba(245, 158, 11, 0.3);
    margin-left: 4px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-type-badge.extra-time {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.2));
    color: var(--info);
    border-color: rgba(59, 130, 246, 0.3);
}

.result-type-badge.pk {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Result type select dropdown styling */
.result-type-select {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.result-type-select:hover {
    border-color: var(--border-color-hover);
    background: var(--bg-card-hover);
}

.result-type-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 51, 160, 0.2);
}
