/* ========================================
   Rock Paper Scissors Tournament System
   Unified Modern Style
   ======================================== */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    background: var(--bg-gradient, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    min-height: 100vh;
    padding: 20px;
    color: var(--ink, #333);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 3px solid #667eea;
}

.header h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

.header p {
    color: #666;
    font-size: 1.1em;
}

/* Navigation Bar */
nav {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 30px;
    text-align: center;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 4px;
    transition: background 0.3s;
    display: inline-block;
}

nav a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Flash Messages */
.flash {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 8px;
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.flash.success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.flash.error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.flash.info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* Stats Boxes */
.stats {
    display: flex;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.stat-box {
    flex: 1;
    min-width: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.stat-box h3 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: bold;
}

.stat-box p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8f9ff;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Forms */
.form-section {
    background: #f8f9ff;
    padding: 25px;
    border-radius: 8px;
    margin: 30px 0;
    border: 2px solid #e0e6ff;
}

.form-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    margin: 5px;
    text-align: center;
}

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

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
}

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

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

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

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

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

.btn-info:hover {
    background: #138496;
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-light {
    background: #f8f9fa;
    color: #212529;
    border: 2px solid #dee2e6;
}

.btn-light:hover {
    background: #e2e6ea;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.2em;
}

/* Action Buttons Container */
.actions {
    margin: 30px 0;
    text-align: center;
}

.actions-inline {
    display: inline-flex;
    gap: 10px;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.card h3 {
    color: #667eea;
    margin-bottom: 15px;
}

/* Grid Layout */
.grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-primary {
    background: #cce5ff;
    color: #004085;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state svg,
.empty-state i {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 10px;
}

/* Loading Spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .stats {
        flex-direction: column;
    }
    
    table {
        font-size: 0.9em;
    }
    
    th, td {
        padding: 8px;
    }
    
    .btn {
        display: block;
        width: 100%;
        margin: 5px 0;
    }
    
    nav a {
        display: block;
        margin: 5px 0;
    }
}

/* === Mobile Card-Table Utility ===
   Füge class="card-table" zur <table> hinzu
   + data-label="..." auf jedes <td> */
@media (max-width: 768px) {
  .card-table thead { display: none; }
  .card-table tbody tr {
    display: block;
    background: white;
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border-left: 4px solid #667eea;
  }
  .card-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    padding: 5px 0;
    font-size: 0.9em;
  }
  .card-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #666;
    flex-shrink: 0;
    margin-right: 12px;
  }
  /* Touch-freundliche Tap-Ziele */
  .btn { min-height: 44px; }
  input, select, textarea { font-size: 16px !important; }
}

/* Kleinere Phones */
@media (max-width: 480px) {
  .container { padding: 10px; }
  .stat-box { min-width: 140px; }
  .header h1 { font-size: 1.5em; }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .container {
        box-shadow: none;
        padding: 0;
    }
    
    .btn, nav {
        display: none;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.p-1 { padding: 10px; }
.p-2 { padding: 20px; }
.p-3 { padding: 30px; }

.hidden { display: none; }
