/**
 * Play Golf Pro - Main App Styles
 * Version: 2.3.0
 */

/* ========================================
   Base Styles
   ======================================== */
.gsp-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: #374151;
}

.gsp-app * {
    box-sizing: border-box;
}

/* ========================================
   Cards & Containers
   ======================================== */
.gsp-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.gsp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.gsp-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.gsp-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 16px 0;
}

/* ========================================
   Grid System
   ======================================== */
.gsp-grid {
    display: grid;
    gap: 20px;
}

.gsp-grid-2 {
    grid-template-columns: repeat(1, 1fr);
}

.gsp-grid-3 {
    grid-template-columns: repeat(1, 1fr);
}

.gsp-grid-4 {
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px) {
    .gsp-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    .gsp-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .gsp-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    .gsp-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   Stats Cards
   ======================================== */
.gsp-stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.gsp-stat-label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
}

.gsp-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
}

.gsp-stat-value.gsp-primary {
    color: #059669;
}

.gsp-stat-change {
    font-size: 13px;
    margin-top: 4px;
}

.gsp-stat-change.positive {
    color: #059669;
}

.gsp-stat-change.negative {
    color: #dc2626;
}

/* ========================================
   Buttons
   ======================================== */
.gsp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.gsp-btn-primary {
    background: #059669;
    color: #fff;
}

.gsp-btn-primary:hover {
    background: #047857;
    color: #fff;
}

.gsp-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.gsp-btn-secondary:hover {
    background: #e5e7eb;
}

.gsp-btn-outline {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
}

.gsp-btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.gsp-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.gsp-btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.gsp-btn-block {
    display: flex;
    width: 100%;
}

/* ========================================
   Forms
   ======================================== */
.gsp-form-group {
    margin-bottom: 16px;
}

.gsp-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.gsp-input,
.gsp-select,
.gsp-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.gsp-input:focus,
.gsp-select:focus,
.gsp-textarea:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.gsp-input::placeholder {
    color: #9ca3af;
}

.gsp-checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gsp-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #059669;
}

/* ========================================
   Tables
   ======================================== */
.gsp-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.gsp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.gsp-table th,
.gsp-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.gsp-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gsp-table tbody tr:hover {
    background: #f9fafb;
}

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

/* ========================================
   Scorecard Table
   ======================================== */
.gsp-scorecard {
    overflow-x: auto;
}

.gsp-scorecard table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.gsp-scorecard th,
.gsp-scorecard td {
    padding: 8px 12px;
    text-align: center;
    border: 1px solid #e5e7eb;
    min-width: 50px;
}

.gsp-scorecard th {
    background: #f9fafb;
    font-weight: 600;
}

.gsp-scorecard .hole-num {
    font-weight: 700;
    color: #059669;
}

.gsp-scorecard .par-row {
    background: #f3f4f6;
}

.gsp-scorecard .score-input {
    width: 50px;
    padding: 6px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

.gsp-score-birdie {
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
}

.gsp-score-eagle {
    background: #fef08a;
    color: #854d0e;
    font-weight: 700;
}

.gsp-score-bogey {
    background: #fee2e2;
    color: #991b1b;
}

.gsp-score-double {
    background: #fecaca;
    color: #7f1d1d;
    font-weight: 600;
}

/* ========================================
   Empty States
   ======================================== */
.gsp-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.gsp-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.gsp-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px;
}

.gsp-empty-text {
    margin: 0 0 20px;
}

/* ========================================
   Alerts & Messages
   ======================================== */
.gsp-alert {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.gsp-alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.gsp-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.gsp-alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.gsp-alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ========================================
   Tabs
   ======================================== */
.gsp-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 20px;
    overflow-x: auto;
}

.gsp-tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.15s;
}

.gsp-tab:hover {
    color: #374151;
}

.gsp-tab.active {
    color: #059669;
    border-bottom-color: #059669;
}

/* ========================================
   Badges
   ======================================== */
.gsp-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 9999px;
}

.gsp-badge-primary {
    background: #ecfdf5;
    color: #059669;
}

.gsp-badge-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

.gsp-badge-success {
    background: #dcfce7;
    color: #166534;
}

.gsp-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.gsp-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* ========================================
   Loading States
   ======================================== */
.gsp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.gsp-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #059669;
    border-radius: 50%;
    animation: gsp-spin 0.8s linear infinite;
}

@keyframes gsp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.gsp-text-center {
    text-align: center;
}

.gsp-text-right {
    text-align: right;
}

.gsp-text-muted {
    color: #6b7280;
}

.gsp-text-success {
    color: #059669;
}

.gsp-text-danger {
    color: #dc2626;
}

.gsp-mt-0 { margin-top: 0; }
.gsp-mt-1 { margin-top: 8px; }
.gsp-mt-2 { margin-top: 16px; }
.gsp-mt-3 { margin-top: 24px; }
.gsp-mb-0 { margin-bottom: 0; }
.gsp-mb-1 { margin-bottom: 8px; }
.gsp-mb-2 { margin-bottom: 16px; }
.gsp-mb-3 { margin-bottom: 24px; }

.gsp-flex {
    display: flex;
}

.gsp-flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gsp-gap-1 { gap: 8px; }
.gsp-gap-2 { gap: 16px; }

/* ========================================
   Round Type Selector
   ======================================== */
.gsp-round-type-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.gsp-round-type-option {
    padding: 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}

.gsp-round-type-option:hover {
    border-color: #059669;
}

.gsp-round-type-option.selected {
    border-color: #059669;
    background: #ecfdf5;
}

.gsp-round-type-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.gsp-round-type-title {
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.gsp-round-type-desc {
    font-size: 13px;
    color: #6b7280;
}

/* ========================================
   Handicap Display
   ======================================== */
.gsp-handicap-display {
    text-align: center;
    padding: 32px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-radius: 16px;
    color: #fff;
    margin-bottom: 24px;
}

.gsp-handicap-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.gsp-handicap-value {
    font-size: 56px;
    font-weight: 700;
    line-height: 1;
}

.gsp-handicap-trend {
    margin-top: 12px;
    font-size: 14px;
}

/* ========================================
   List Items
   ======================================== */
.gsp-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s;
}

.gsp-list-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gsp-list-item-icon {
    width: 48px;
    height: 48px;
    background: #ecfdf5;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.gsp-list-item-content {
    flex: 1;
    min-width: 0;
}

.gsp-list-item-title {
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.gsp-list-item-subtitle {
    font-size: 14px;
    color: #6b7280;
}

.gsp-list-item-value {
    font-size: 20px;
    font-weight: 700;
    color: #059669;
}


/* ========================================
   Theme Toggle Switch
   ======================================== */
.gsp-theme-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.gsp-theme-label {
    font-size: 14px;
    color: #6b7280;
}

.gsp-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.gsp-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.gsp-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e7eb;
    transition: 0.3s;
    border-radius: 28px;
}

.gsp-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.gsp-switch input:checked + .gsp-slider {
    background-color: #166534;
}

.gsp-switch input:checked + .gsp-slider:before {
    transform: translateX(24px);
}

/* ========================================
   Dark Theme Variables
   ======================================== */
:root[data-theme="dark"] {
    --gsp-bg-primary: #0f1f0f;
    --gsp-bg-secondary: #1a2e1a;
    --gsp-bg-card: #1e3a1e;
    --gsp-text-primary: #e5e7eb;
    --gsp-text-secondary: #9ca3af;
    --gsp-border-color: #2d4a2d;
    --gsp-accent: #22c55e;
}

:root[data-theme="light"] {
    --gsp-bg-primary: #f9fafb;
    --gsp-bg-secondary: #ffffff;
    --gsp-bg-card: #ffffff;
    --gsp-text-primary: #111827;
    --gsp-text-secondary: #6b7280;
    --gsp-border-color: #e5e7eb;
    --gsp-accent: #166534;
}

/* Apply dark theme styles */
[data-theme="dark"] .gsp-app {
    background-color: var(--gsp-bg-primary);
    color: var(--gsp-text-primary);
}

[data-theme="dark"] .gsp-card,
[data-theme="dark"] .gsp-stat-card {
    background-color: var(--gsp-bg-card);
    border-color: var(--gsp-border-color);
}

[data-theme="dark"] .gsp-card-title,
[data-theme="dark"] .gsp-section-title,
[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3 {
    color: var(--gsp-text-primary);
}

[data-theme="dark"] .gsp-settings-section {
    background-color: var(--gsp-bg-card);
    border-color: var(--gsp-border-color);
}

[data-theme="dark"] .gsp-input,
[data-theme="dark"] .gsp-select,
[data-theme="dark"] .gsp-textarea {
    background-color: var(--gsp-bg-secondary);
    border-color: var(--gsp-border-color);
    color: var(--gsp-text-primary);
}

[data-theme="dark"] .gsp-form-help {
    color: var(--gsp-text-secondary);
}

[data-theme="dark"] .gsp-sidebar {
    background-color: var(--gsp-bg-secondary);
    border-color: var(--gsp-border-color);
}

[data-theme="dark"] .gsp-nav-item {
    color: var(--gsp-text-primary);
}

[data-theme="dark"] .gsp-nav-item:hover {
    background-color: var(--gsp-bg-card);
}

[data-theme="dark"] .gsp-header {
    background-color: var(--gsp-bg-secondary);
    border-color: var(--gsp-border-color);
}

[data-theme="dark"] .gsp-table th,
[data-theme="dark"] .gsp-table td {
    border-color: var(--gsp-border-color);
}

[data-theme="dark"] .gsp-table tr:hover {
    background-color: var(--gsp-bg-card);
}

[data-theme="dark"] .gsp-btn-secondary {
    background-color: var(--gsp-bg-card);
    border-color: var(--gsp-border-color);
    color: var(--gsp-text-primary);
}

/* ========================================
   Settings Page Styles
   ======================================== */
.gsp-settings {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

.gsp-settings-header {
    margin-bottom: 32px;
}

.gsp-settings-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px 0;
}

.gsp-settings-header p {
    font-size: 15px;
    color: #6b7280;
    margin: 0;
}

.gsp-settings-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin-bottom: 24px;
}

.gsp-settings-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

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

.gsp-settings-form .gsp-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.gsp-settings-form .gsp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .gsp-settings-form .gsp-form-row {
        grid-template-columns: 1fr;
    }
}

.gsp-settings-form .gsp-input,
.gsp-settings-form .gsp-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.gsp-settings-form .gsp-input:focus,
.gsp-settings-form .gsp-select:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.gsp-settings-form .gsp-input::placeholder {
    color: #9ca3af;
}

.gsp-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    padding: 8px 0;
}

.gsp-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #059669;
    cursor: pointer;
}

.gsp-form-help {
    font-size: 13px;
    color: #6b7280;
    margin-top: 8px;
}

.gsp-theme-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.gsp-theme-label {
    font-size: 14px;
    color: #6b7280;
}

.gsp-data-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gsp-data-actions .gsp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
}

.gsp-data-actions .gsp-icon {
    width: 18px;
    height: 18px;
}

.gsp-settings-actions {
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
}

.gsp-settings-actions .gsp-btn-lg {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
}

/* Dark theme settings */
[data-theme="dark"] .gsp-settings-header h1 {
    color: var(--gsp-text-primary);
}

[data-theme="dark"] .gsp-settings-header p {
    color: var(--gsp-text-secondary);
}

[data-theme="dark"] .gsp-settings-section h2 {
    color: var(--gsp-text-primary);
    border-color: var(--gsp-border-color);
}

[data-theme="dark"] .gsp-checkbox-label {
    color: var(--gsp-text-primary);
}

[data-theme="dark"] .gsp-settings-actions {
    border-color: var(--gsp-border-color);
}
