/* Golf Club Pal Shared Styles */

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #0ea5e9;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-dark: #0f172a;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Ubuntu', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    padding-top: 80px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header p {
    opacity: 0.9;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid white;
}

.nav-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.nav-tab {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-tab:hover {
    color: var(--primary-color);
    background: var(--bg-secondary);
}

.nav-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.card {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: inherit;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.item-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.item-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.item-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    background: var(--bg-secondary);
}

.item-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.item-card .meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.item-card .value {
    font-weight: 600;
    color: var(--success-color);
    font-size: 1.1rem;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

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

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

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.error {
    text-align: center;
    padding: 2rem;
    color: var(--danger-color);
    background: #fee2e2;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Collapsible details section */
details {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-top: 1rem;
    overflow: hidden;
}

details summary {
    list-style: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    user-select: none;
    transition: background-color 0.2s;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary:hover {
    background: var(--border-color);
}

details[open] summary {
    border-bottom: 1px solid var(--border-color);
}

details[open] summary .fa-chevron-down {
    transform: rotate(180deg);
}

/* Drawer backdrop overlay */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.show {
    opacity: 1;
}

/* Drawer styles for tournament selector */
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 350px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: block; /* Always in DOM for transitions */
    visibility: hidden; /* Hidden by default */
}

.drawer.open {
    transform: translateX(0);
    visibility: visible; /* Show when open */
}

/* Tournament results drawer (second drawer) - slides out from the first drawer */
.drawer-results {
    left: 350px; /* Position it to the right of the first drawer */
    width: calc(100vw - 350px); /* Take up remaining space */
    max-width: 800px; /* But cap at 800px */
    z-index: 1002; /* Above the first drawer */
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2); /* Shadow on the right side */
}

/* When first drawer is open, position results drawer relative to it */
#tournamentsDrawer.open ~ #tournamentResultsDrawer {
    left: 350px;
}

/* When first drawer is closed, results drawer should also be hidden/closed */
#tournamentsDrawer:not(.open) ~ #tournamentResultsDrawer.open {
    transform: translateX(-100%);
}

.drawer-content {
    padding: 2rem;
    height: 100%;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.drawer-header h2 {
    color: var(--primary-color);
    margin: 0;
}
