/* Handicap Tracker - Professional Styling (styles.css)
   Updated: visible input text + grid sizing consistent across pages */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #27ae60;
    --accent-color: #e67e22;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
    --danger-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 0;
    padding: 0;
    background-color: #f5f7fa;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styling */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    min-height: 60px;
}

header img.logo {
    height: 75px !important;
    width: 75px !important;
    max-height: 75px;
    max-width: 75px;
    margin-right: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

header h1 {
    color: white;
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
    flex-grow: 1;
}

/* Navigation */
.nav-links {
    display: flex;
    background-color: var(--dark-color);
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    margin-right: 5px;
    margin-bottom: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-links a:hover, .nav-links a.active {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
}

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

th {
    background-color: var(--primary-color);
    color: white;
    text-align: left;
    padding: 1rem;
    font-weight: 600;
    font-size: 0.95rem;
}

td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #e9ecef;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:hover {
    background-color: #e8f4f8;
}

/* Score Table Specific Styling */
.score-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 6px;
    overflow: hidden;
    table-layout: fixed; /* evenly distributes columns */
}

/* Ensure enough width for inputs and labels */
.score-table th,
.score-table td {
    min-width: 70px;           /* match inline working version */
    text-align: center;
    padding: 0.6rem;
}
.score-table th:first-child,
.score-table td:first-child {
    min-width: 90px;          /* Hole/Par/Score column */
}

.score-table tr:nth-child(even) { background-color: #f8f9fa; }

/* =========================================================
   Score Input Fields (final values from working inline CSS)
   ========================================================= */
.score-table input[type="number"],
.hole-input {
    width: 64px !important;        /* visible width */
    height: 36px !important;       /* taller for legibility */
    padding: 6px 8px !important;
    border: 2px solid #bfc8d4 !important;
    border-radius: 6px !important;
    text-align: center !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    background-color: #fff !important;
    box-sizing: border-box !important;
    transition: all 0.3s ease !important;

    color: #111 !important;                  /* make numbers dark */
    -webkit-text-fill-color: #111 !important;/* Safari/WebKit */
    caret-color: #111 !important;            /* cursor color */

    pointer-events: auto !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    -ms-user-select: auto !important;
    appearance: textfield; /* remove spinners best-effort */
}

/* Placeholder: lighter to distinguish from values */
.score-table input[type="number"]::placeholder,
.hole-input::placeholder {
    color: #9aa7b5 !important;
    font-weight: 400 !important;
    opacity: 1 !important; /* Firefox */
}

.score-table input[type="number"]:focus,
.hole-input:focus {
    outline: none !important;
    border-color: var(--secondary-color) !important;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.18) !important;
    background-color: #f8fff9 !important;
    color: #111 !important;
    -webkit-text-fill-color: #111 !important;
}

.score-table input[type="number"]:hover,
.hole-input:hover { border-color: var(--secondary-color) !important; }

/* Keep disabled/read-only readable */
.score-table input[type="number"]:disabled,
.score-table input[type="number"][readonly],
.hole-input:disabled,
.hole-input[readonly] {
    pointer-events: auto !important;
    background-color: #fff !important;
    color: #111 !important;
    -webkit-text-fill-color: #111 !important;
    opacity: 1 !important;
}

/* Form Styling */
.form-container {
    background-color: white;
    border-radius: 6px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.form-group {
    margin-bottom: 1.5rem;
    flex: 1;
    min-width: 250px;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.form-control,
input[type="text"], 
input[type="number"], 
input[type="date"], 
select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

/* Ensure all inputs (including text) look consistent */
input[type="text"],
input[type="number"],
input[type="date"],
select,
.form-control {
    height: 42px;
    line-height: 1.4;
}

.form-control:focus,
input[type="text"]:focus, 
input[type="number"]:focus, 
input[type="date"]:focus, 
select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

/* Total Display */
.total-display {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.total-display span { display: inline-block; margin: 0 1rem; }

/* Messages */
.success-message {
    background-color: #d4edda !important;
    border: 2px solid #c3e6cb !important;
    color: #155724 !important;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.error-message {
    background-color: #f8d7da !important;
    border: 2px solid #f5c6cb !important;
    color: #721c24 !important;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.success-message p,
.error-message p { margin: 0; font-weight: 600; }

/* Buttons */
button, .btn {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 0.25rem;
}

button:hover, .btn:hover {
    background-color: #229954;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-primary { background-color: var(--secondary-color); }
.btn-primary:hover { background-color: #229954; }

.btn-danger { background-color: var(--danger-color); }
.btn-danger:hover { background-color: #c0392b; }

.btn-secondary { background-color: var(--dark-color); }
.btn-secondary:hover { background-color: #2c3e50; }

.btn-block { width: 100%; display: block; margin: 0.5rem 0; }

/* Card */
.card {
    background-color: white;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.card h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Filter Section */
.filter-section {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-form {
    display: flex;
    align-items: end;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-form .form-group { margin-bottom: 0; min-width: 200px; }

.filter-form label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.filter-form select {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    min-width: 200px;
}

.filter-form select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

/* Results Summary */
.results-summary {
    margin: 1rem 0;
    padding: 0.75rem;
    background-color: #e8f4fd;
    border-left: 4px solid var(--secondary-color);
    border-radius: 4px;
}

.results-summary p { margin: 0; color: var(--primary-color); }

/* Table improvements */
table thead { background-color: var(--primary-color); }

table tbody tr:hover { background-color: #f1f8ff; }

/* Footer */
footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 3rem;
}

footer p { margin: 0; font-size: 0.9rem; }

/* Responsive Design */
@media (max-width: 768px) {
    .header { flex-direction: column; text-align: center; padding: 1rem; }
    .header .logo { margin-bottom: 0.5rem; margin-right: 0; }
    .nav-links { flex-direction: column; }
    .nav-links a { margin-right: 0; margin-bottom: 0.5rem; text-align: center; }
    .container { padding: 10px; }
    .form-row { flex-direction: column; }
    .form-group { min-width: 100%; }
    table { font-size: 0.9rem; }
    th, td { padding: 0.5rem; }
    .score-table th, .score-table td { padding: 0.4rem 0.2rem; }
    .score-table input[type="number"], .hole-input {
        width: 50px !important; padding: 6px 2px !important; font-size: 13px !important; height: 34px !important;
    }
    .total-display { font-size: 1rem; }
    .total-display span { display: block; margin: 0.5rem 0; }
}

@media (max-width: 480px) {
    .header .title, .header h1 { font-size: 1.4rem; }
    .header .logo { height: 40px !important; width: 40px !important; max-height: 40px !important; max-width: 40px !important; }
    button, .btn { width: 100%; margin-bottom: 0.5rem; }
    .score-table { font-size: 0.8rem; }
    .score-table th, .score-table td { padding: 0.3rem 0.1rem; }
    .score-table input[type="number"], .hole-input {
        width: 44px !important; padding: 4px 1px !important; font-size: 12px !important; height: 32px !important;
    }
    .form-container { padding: 1rem; }
}

/* Ensure inputs work on all devices and browsers */
* { box-sizing: border-box; }

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

input[type="number"] { -moz-appearance: textfield; }
