/* =========================================
   RESET & VARIABLES
   ========================================= */
:root {
    /* Brand Colors (Clean Sports UI) */
    --primary: #2563EB;       /* Royal Blue */
    --primary-dark: #1E40AF;
    --primary-light: #DBEAFE;

    --secondary: #10B981;     /* Emerald Green */
    
    --dark: #111827;          /* Near Black */
    --grey-dark: #374151;
    --grey-med: #9CA3AF;
    --grey-light: #F3F4F6;
    --white: #FFFFFF;

    --danger: #EF4444;
    
    /* Spacing & Layout */
    --container-padding: 1.25rem;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --font-main: 'Manrope', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--grey-light);
    color: var(--dark);
    font-family: var(--font-main);
    line-height: 1.5;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img, svg { display: block; max-width: 100%; }

/* =========================================
   TYPOGRAPHY
   ========================================= */
h1, h2, h3, h4, h5, h6 {
    color: var(--dark);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

h1 { font-size: 2.25rem; letter-spacing: -0.02em; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

p {
    color: var(--grey-dark);
    margin-bottom: 1.5rem;
}

/* =========================================
   LAYOUT UTILITIES
   ========================================= */
.container {
    width: 100%;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
    margin-left: auto;
    margin-right: auto;
}

/* Mobile-first: container is fluid by default */
@media (min-width: 640px) { .container { max-width: 640px; } }
@media (min-width: 768px) { .container { max-width: 768px; } }
@media (min-width: 1024px) { .container { max-width: 1024px; } }
@media (min-width: 1280px) { .container { max-width: 1280px; } }

main.container {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 4rem;
}

/* =========================================
   BUTTONS (Touch Friendly)
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem; /* Large touch target */
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    width: 100%; /* Full width on mobile */
    text-align: center;
}

@media (min-width: 640px) {
    .btn { width: auto; } /* Auto width on larger screens */
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
}
.btn-primary:active { transform: translateY(1px); }
.btn-primary:hover { background-color: var(--primary-dark); }

.btn-secondary {
    background-color: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary-light);
}
.btn-secondary:hover { border-color: var(--primary); background-color: var(--primary-light); }

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* =========================================
   NAVBAR (Mobile First)
   ========================================= */
.navbar {
    background-color: var(--white);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.75rem 0;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping for mobile menu */
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--dark);
}

.brand-logo {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 900;
    transform: rotate(-3deg);
}

/* Mobile Nav Toggle */
.nav-toggle { display: none; }
.nav-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 5px;
}
.nav-toggle-label span {
    display: block;
    width: 24px;
    height: 3px;
    background-color: var(--dark);
    border-radius: 3px;
    transition: 0.3s;
}

/* Mobile Nav Links (Hidden by default) */
.nav-links {
    width: 100%;
    display: none; /* Hidden on mobile */
    flex-direction: column;
    gap: 1rem;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--grey-light);
}

.nav-toggle:checked ~ .nav-links {
    display: flex; /* Show when checked */
}

.nav-item {
    font-weight: 600;
    color: var(--grey-dark);
    padding: 0.5rem 0;
}
.nav-item:hover { color: var(--primary); }

.nav-btn {
    width: 100%;
    margin-top: 0.5rem;
}

/* Desktop Nav Override */
@media (min-width: 768px) {
    .nav-toggle-label { display: none; }
    .nav-links {
        display: flex !important;
        width: auto;
        flex-direction: row;
        align-items: center;
        gap: 2rem;
        padding-top: 0;
        margin-top: 0;
        border-top: none;
    }
    .nav-btn { width: auto; margin-top: 0; }
}

/* =========================================
   HOME / LANDING
   ========================================= */
.hero-section {
    padding: 3rem 0;
    text-align: center;
}

.hero-tag {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    letter-spacing: 0.05em;
}

.hero-visual {
    margin: 3rem 0;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0,0,0,0.03);
}

.hero-visual img {
    border-radius: var(--radius-md);
    width: 100%;
    height: auto;
}

/* Feature Grid (Cards) */
.features-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 4rem;
}

@media (min-width: 640px) {
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-section { padding: 5rem 0; }
}
@media (min-width: 1024px) {
    .features-grid { grid-template-columns: repeat(3, 1fr); }
}

.feature-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.feature-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

/* =========================================
   DASHBOARD & LISTS
   ========================================= */
.dashboard-head {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .dashboard-head { flex-direction: row; justify-content: space-between; align-items: flex-end; }
}

.tourney-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tourney-item {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
}
.tourney-item:hover { border-color: var(--primary-light); }

.t-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.t-title { font-size: 1.1rem; font-weight: 700; margin: 0; }
.t-meta { font-size: 0.9rem; color: var(--grey-med); margin-top: 0.25rem; }

.t-status {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    background: var(--grey-light);
    color: var(--grey-dark);
}
.t-status.in_progress { background: #FEF3C7; color: #D97706; }
.t-status.completed { background: #D1FAE5; color: #059669; }

.t-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

/* Tablet: Make list items look more like rows */
@media (min-width: 768px) {
    .tourney-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .t-header { flex-direction: column; }
    .t-actions { margin-top: 0; }
}

/* =========================================
   FORMS
   ========================================= */
.card-form {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    max-width: 480px;
    margin: 0 auto;
}

.form-group { margin-bottom: 1.5rem; }
.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 2px solid var(--grey-light);
    font-family: inherit;
    font-size: 1rem;
    transition: 0.2s;
    background: #F9FAFB;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
}

/* =========================================
   FOOTER
   ========================================= */
.footer {
    background: var(--white);
    padding: 3rem 0 2rem;
    margin-top: auto;
    border-top: 1px solid var(--grey-light);
    text-align: center;
    font-size: 0.9rem;
    color: var(--grey-med);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.footer-links a { color: var(--grey-dark); font-weight: 600; }
