/* Tony's Tennis Page & Trackers - Refactored Styles v2 */

/* Add this to the top */
.tennis-body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    padding: 1rem;
}

/* --- General & Body --- */
.tennis-tracker-body {
    font-family: Arial, sans-serif;
    color: white;
    margin: 0;
    padding: 0;
    min-height: 100dvh;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

/* --- Containers & Headers --- */
.tennis-tracker-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.tennis-tracker-header {
    text-align: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
}

.tennis-tracker-header h1 {
    font-size: 2.2rem;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.subtitle-text {
    color: #FFE135;
    font-style: italic;
    opacity: 0.9;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* --- Navigation --- */
.tennis-nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tennis-nav-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.tennis-nav-btn:hover, .tennis-nav-btn.active {
    background: rgba(255, 225, 53, 0.4);
    color: #FFE135;
    transform: translateY(-2px);
}

/* --- Sections --- */
.tennis-section {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tennis-section.active { display: block; }

.section-title {
    text-align: center;
    color: #FFE135;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

/* --- Forms & Grids --- */
.tennis-form-group { margin-bottom: 1rem; }
.tennis-form-group label { display: block; margin-bottom: 0.5rem; font-weight: bold; color: #FFE135; }
.tennis-form-group input, .tennis-form-group select { width: 100%; padding: 0.8rem; border: none; border-radius: 8px; background: rgba(255, 255, 255, 0.9); color: #333; font-size: 1rem; box-sizing: border-box; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.team-setup-grid, .returner-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }

@media (min-width: 600px) {
    .team-setup-grid, .returner-grid { grid-template-columns: 1fr 1fr; }
    .score-grid { grid-template-columns: 1fr 100px 1fr; }
}

/* --- Cards --- */
.stat-card, .team-card { background: rgba(255, 255, 255, 0.15); padding: 1rem; border-radius: 8px; text-align: center; }
.team-card { padding: 1.5rem; }
.control-card, .second-shot-card { background: rgba(0, 0, 0, 0.2); margin-bottom: 1.5rem; }
.returner-card { padding-bottom: 1.5rem; }
.stat-label { font-size: 0.9rem; opacity: 0.8; margin-bottom: 0.25rem; }
.stat-value { font-size: 1.8rem; font-weight: bold; color: #FFE135; margin-bottom: 0.5rem; }

/* --- Buttons --- */
.tennis-btn { background: rgba(255, 225, 53, 0.8); color: #333; border: none; padding: 0.6rem 1rem; border-radius: 8px; cursor: pointer; font-weight: bold; transition: all 0.2s ease; flex-grow: 1; }
.tennis-btn:hover { background: rgba(255, 225, 53, 1); transform: translateY(-1px); }
.tennis-btn-group { display: flex; gap: 0.5rem; justify-content: center; }
.tennis-btn-group.compact { gap: 0.25rem; }
.tennis-btn-group.compact .tennis-btn { padding: 0.5rem 0.8rem; font-size: 0.9rem; }

/* --- Specific Component Styles --- */
.server-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    align-items: end;
}

.tennis-tracker-body:not(.doubles-tracker-body) .server-row {
    grid-template-columns: 2fr 1fr;
}

@media (max-width: 768px) {
    .tennis-tracker-body:not(.doubles-tracker-body) .server-row {
        grid-template-columns: 2fr 1fr;
    }
}
.server-dropdown { width: 100%; padding: 0.7rem; border-radius: 8px; font-weight: bold; }
.return-section { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.return-string-display { min-height: 2.5rem; background: rgba(0,0,0,0.2); border-radius: 4px; padding: 0.5rem; font-family: monospace; word-break: break-all; margin-bottom: 0.5rem; }
.deuce-side-border { border-left: 4px solid rgba(0, 200, 100, 0.7); }
.ad-side-border { border-left: 4px solid rgba(200, 0, 100, 0.7); }

.second-shot-title { color: #FFC107; margin: 0 0 0.5rem 0; }
.positions-display { font-size: 0.9rem; opacity: 0.8; margin-bottom: 1rem; font-weight: bold; }
.ss-miss-tally { margin-top: 1rem; display: flex; justify-content: center; flex-wrap: wrap; gap: 1.5rem; font-size: 0.9rem; font-weight: bold; min-width: 300px; }

.team-1-bg { background-color: rgba(0, 100, 200, 0.3); }
.team-2-bg { background-color: rgba(200, 0, 0, 0.3); }
.team-title-blue { color: #6BB6FF; margin-bottom: 1rem; }
.team-title-red { color: #FF6B6B; margin-bottom: 1rem; }

/* --- Results View Styles --- */
.results-navigation { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.nav-dot { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); cursor: pointer; transition: all 0.3s ease; }
.nav-dot.active { background: #FFE135; transform: scale(1.2); }
.swipe-hint { text-align: center; font-size: 0.8rem; opacity: 0.6; margin-bottom: 1rem; }
.results-view { display: none; }
.view-title { text-align: center; font-size: 1.5rem; color: #FFE135; margin-bottom: 1rem; }
.match-summary, .player-card, .team-card { background: rgba(0, 0, 0, 0.2); padding: 1.5rem; border-radius: 10px; margin-bottom: 1rem; }
.results-subtitle { margin-top: 0; margin-bottom: 1rem; color: #FFE135; border-bottom: 1px solid rgba(255,225,53,0.3); padding-bottom: 0.5rem; }
.final-score { font-size: 1.8rem; font-weight: bold; text-align: center; margin-bottom: 0.5rem; }
.match-details { text-align: center; font-size: 0.9rem; opacity: 0.8; }
.side-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.side-card { padding: 1rem; border-radius: 8px; }
.side-title { margin-top: 0; }
.deuce-side { background: rgba(0, 200, 100, 0.1); }
.ad-side { background: rgba(200, 0, 100, 0.1); }
.results-view .stat-value small { display: block; font-size: 0.8rem; color: white; opacity: 0.7; font-weight: normal; }
.text-center { text-align: center; margin-top: 1.5rem; }

@media (max-width: 768px) {
    input, select, textarea { font-size: 16px; }
    .side-stats { grid-template-columns: 1fr; }
}

/* PDF Export Styles */
body.pdf-export-mode .tennis-nav,
body.pdf-export-mode .results-navigation,
body.pdf-export-mode .swipe-hint,
body.pdf-export-mode .text-center button {
    display: none;
}

body.pdf-export-mode .results-view {
    display: block !important;
    background: white;
    color: #333;
}

body.pdf-export-mode .match-summary,
body.pdf-export-mode .player-card,
body.pdf-export-mode .team-card {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #dee2e6;
}

body.pdf-export-mode .view-title,
body.pdf-export-mode .results-subtitle,
body.pdf-export-mode .stat-value,
body.pdf-export-mode .team-title-blue,
body.pdf-export-mode .team-title-red {
    color: #0056b3;
}

/* --- Results Table Styles --- */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.results-table th, .results-table td {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.results-table thead {
    background-color: rgba(0, 0, 0, 0.2);
    color: #FFE135;
}

.results-table td:first-child {
    font-weight: bold;
    text-align: left;
}

body.pdf-export-mode .results-table th,
body.pdf-export-mode .results-table td {
    border: 1px solid #ccc;
}

body.pdf-export-mode .results-table thead {
    background-color: #e9ecef;
    color: #333;
}

/* --- Tony's Tennis Page Specific Styles --- */
.tennis-body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    padding: 1rem;
}

.tennis-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tennis-header h1 {
    font-size: 2.5rem;
    margin: 0;
    color: #FFE135;
}

.tennis-header p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
}

.tennis-container {
    max-width: 900px;
    margin: 0 auto;
}

.tennis-tools {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .tennis-tools {
        grid-template-columns: 1fr 1fr;
    }
} /* <--- THIS IS THE MISSING BRACKET THAT WAS ADDED */

.tool-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.tool-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.tool-card h3 {
    font-size: 1.5rem;
    color: #FFE135;
    margin-bottom: 0.5rem;
}

.tool-card p {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.6;
    min-height: 80px;
}

.tool-link {
    display: inline-block;
    background: #FFE135;
    color: #1e3c72;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.tool-link:hover {
    background-color: #fff;
}

.resource-card {
    text-align: center;
    margin-top: 2.5rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.resource-card h3 {
    color: #FFE135;
    margin-top: 0;
}

.tool-link.secondary {
    background: transparent;
    border: 2px solid #FFE135;
    color: #FFE135;
}

.tool-link.secondary:hover {
    background: #FFE135;
    color: #1e3c72;
}

.tennis-back-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
}

/* --- Second Shot Article Page Styles --- */
.article-container {
    max-width: 800px;
    margin: 0 auto;
    background: #ffffff;
    color: #333;
    border-radius: 15px;
    padding: 2rem 2.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.article-title {
    color: #1e3c72;
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.article-subtitle {
    color: #1e3c72;
    margin-top: 2rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.article-container .subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: #6c757d;
    font-style: italic;
    margin-bottom: 2rem;
}

.article-container p {
    line-height: 1.7;
    margin-bottom: 1rem;
}

.highlight-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    margin: 2rem 0;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
}

.level-section {
    background: #f8f9fa;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 5px solid #1e3c72;
    border-radius: 0 8px 8px 0;
}

.level-title {
    color: #1e3c72;
    font-size: 1.3rem;
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 1rem;
}

.expert-quote {
    border-left: 4px solid #667eea;
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #495057;
}

.stat-highlight {
    color: #667eea;
    font-weight: bold;
}

.cta-section {
    background: #f8f9fa;
    color: #333;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    margin-top: 2.5rem;
}

.cta-button {
    display: inline-block;
    background: #1e3c72;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 1rem;
    transition: transform 0.2s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    background: #2a5298;
}

.tennis-icon {
    font-size: 1.8rem;
    vertical-align: middle;
}
/*
/* --- Strategy Calculator Styles --- 

.strategy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin: 20px auto;
    max-width: 800px;
}

.strategy-grid .grid-cell {
    background-color: #2c3e50;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ecf0f1;
}

.strategy-grid .grid-cell.header {
    background-color: #34495e;
    font-weight: bold;
    text-align: center;
}

.strategy-grid .form-control {
    background-color: #ecf0f1;
    color: #2c3e50;
    border: none;
    text-align: center;
    font-size: 1.2rem;
}

.results-container {
    max-width: 800px;
    margin: 30px auto;
    padding: 20px;
    background-color: #34495e;
    border-radius: 8px;
}

.result-card {
    background-color: #2c3e50;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    color: #ecf0f1;
}

.result-card h3 {
    color: #f1c40f;
    margin-bottom: 15px;
}

.result-card p {
    font-size: 1.2rem;
    line-height: 1.6;
}

/* --- Instructions Page Styles --- 
.instructions-content {
    max-width: 800px;
    margin: auto;
    background-color: #34495e;
    padding: 30px;
    border-radius: 8px;
    color: #ecf0f1;
}

.example-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 5px;
    margin-top: 20px;
    font-size: 0.9rem;
}

.example-grid .grid-cell {
    background-color: #2c3e50;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

.example-grid .grid-cell.header {
    background-color: #466380;
    font-weight: bold;
}
*/

/* The following styles are for the strategy calculators. */
/* Add or modify this section in tennisstyles.css */
.results-table th, .results-table td {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* NEW: Ensure sufficient width for player names */
    min-width: 80px; /* Adjust this value as needed */
    vertical-align: middle; /* Align content nicely */
}

/* Also, add a specific rule for the side-header cells */
.results-table th[rowspan="2"] {
    text-align: left;
    white-space: nowrap; /* Prevents text from wrapping */
}

/*
    PDF-specific styles for better capture.
    Added by Gemini to ensure white background and black text on capture,
    and a narrower, centered content width.
*/
.pdf-capture-light,
.pdf-capture-light * {
  color: #000 !important;
  background: #fff !important;
  text-shadow: none !important;
  box-shadow: none !important;
}

.pdf-page-content {
    max-width: 200mm; /* A4 width is 210mm, leaving a 5mm margin on each side */
    margin: 0 auto; /* Center the content */
}
