/**
 * KentCarp - Main Stylesheet
 * Clean, modern design optimized for iPad and desktop
 */

/* ===== CSS Variables ===== */
:root {
    /* Colors */
    --primary: #1B4332;
    --primary-hover: #2D6A4F;
    --secondary: #2D6A4F;
    --accent: #D4A373;
    --background: #F8F9FA;
    --surface: #FFFFFF;
    --text: #212529;
    --text-light: #6C757D;
    --border: #DEE2E6;
    --error: #DC3545;
    --success: #198754;
    --warning: #F59E0B;
    
    /* Lake type colors */
    --lake-day-ticket: #10B981;
    --lake-syndicate: #6366F1;
    --lake-club: #F59E0B;
    --lake-private: #EF4444;
    --lake-free: #8B5CF6;
    
    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-logo: 'Playfair Display', serif;
    
    /* Font sizes - iPad optimized */
    --text-xs: 0.8125rem;
    --text-sm: 0.9375rem;
    --text-base: 1.125rem;
    --text-lg: 1.3125rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;
    --text-3xl: 2.5rem;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Touch targets */
    --touch-target: 44px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition: 0.2s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text);
    background: var(--background);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    font-family: inherit;
}

input, select, textarea, button {
    font-size: var(--text-base);
}

.hidden {
    display: none !important;
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

/* ===== Logo ===== */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    font-size: 1.75rem;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: var(--touch-target);
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    white-space: nowrap;
}

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

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

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

.btn-secondary:hover {
    background: #CED4DA;
}

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

.btn-danger:hover {
    background: #BB2D3B;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    min-height: 36px;
    padding: var(--space-xs) var(--space-md);
    font-size: var(--text-xs);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-target);
    height: var(--touch-target);
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text);
    transition: background var(--transition);
}

.btn-icon:hover {
    background: var(--border);
}

.btn-tool {
    width: 100%;
    justify-content: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

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

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

/* ===== Forms ===== */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--text-light);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: var(--touch-target);
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 67, 50, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #ADB5BD;
}

.form-group input[readonly] {
    background: var(--background);
    color: var(--text-light);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: var(--touch-target);
    cursor: pointer;
}

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

/* ===== Alerts ===== */
.alert {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: var(--text-sm);
}

.alert-error {
    background: #F8D7DA;
    color: #842029;
    border: 1px solid #F5C2C7;
}

.alert-success {
    background: #D1E7DD;
    color: #0F5132;
    border: 1px solid #BADBCC;
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.login-container {
    display: flex;
    gap: var(--space-xl);
    max-width: 900px;
    width: 100%;
}

.login-card {
    flex: 1;
    background: var(--surface);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-header .logo {
    justify-content: center;
    margin-bottom: var(--space-sm);
}

.tagline {
    color: var(--text-light);
    font-size: var(--text-sm);
}

.login-form {
    margin-bottom: var(--space-lg);
}

.login-footer {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-light);
}

.login-features {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-lg);
    color: white;
}

.feature {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.feature-icon {
    font-size: 2rem;
}

.feature h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-xs);
}

.feature p {
    font-size: var(--text-sm);
    opacity: 0.9;
}

@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
    }
    
    .login-features {
        display: none;
    }
}

/* ===== Dashboard Layout ===== */
.dashboard-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 var(--space-md);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 100;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-center {
    flex: 1;
    max-width: 400px;
    margin: 0 var(--space-lg);
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box input {
    width: 100%;
    height: var(--touch-target);
    padding: var(--space-sm) var(--space-md) var(--space-sm) 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--background);
    font-size: var(--text-sm);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

/* Weather Widget */
.weather-widget {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--background);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 500;
}

.weather-temp {
    color: var(--primary);
}

.wind-indicator {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wind-arrow {
    width: 16px;
    height: 16px;
    background: var(--secondary);
    clip-path: polygon(50% 0%, 100% 100%, 50% 70%, 0% 100%);
    transition: transform 0.5s ease;
}

.weather-wind {
    color: var(--text-light);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
}

.user-btn:hover {
    background: var(--background);
}

.user-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.user-name {
    font-weight: 500;
    font-size: var(--text-sm);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-xs);
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
}

.user-dropdown.show {
    display: block;
}

.dropdown-header {
    padding: var(--space-md);
}

.dropdown-header strong {
    display: block;
}

.dropdown-header small {
    color: var(--text-light);
    font-size: var(--text-xs);
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border);
}

.dropdown-item {
    display: block;
    padding: var(--space-md);
    color: var(--text);
    font-size: var(--text-sm);
}

.dropdown-item:hover {
    background: var(--background);
    text-decoration: none;
}

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform var(--transition);
}

.sidebar.collapsed {
    transform: translateX(-100%);
    width: 0;
}

.sidebar-section {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.sidebar-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-md);
}

/* Filter Checkboxes */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: var(--touch-target);
    padding: var(--space-xs) var(--space-sm);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.filter-checkbox:hover {
    background: var(--background);
}

.filter-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.filter-label {
    flex: 1;
    font-size: var(--text-sm);
}

.filter-dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
}

/* Tool Buttons */
.tool-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* Lake List */
.lake-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.lake-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}

.lake-list-item:hover {
    background: var(--background);
}

.lake-list-item .dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.lake-list-item .name {
    flex: 1;
    font-size: var(--text-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lake-list-item .acres {
    font-size: var(--text-xs);
    color: var(--text-light);
}

.empty-state {
    color: var(--text-light);
    font-size: var(--text-sm);
    font-style: italic;
}

/* Map Wrapper */
.map-wrapper {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

.map-info {
    position: absolute;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-sm) var(--space-md);
    background: var(--surface);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    font-size: var(--text-sm);
    font-weight: 500;
    z-index: 1000;
}

/* Detail Panel */
.detail-panel {
    position: absolute;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transition: right var(--transition);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.detail-panel.open {
    right: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.panel-actions {
    display: flex;
    gap: var(--space-sm);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

/* Panel Lake Detail Content */
.lake-gallery {
    margin: calc(-1 * var(--space-lg));
    margin-bottom: var(--space-lg);
    height: 200px;
    background: var(--background);
    overflow: hidden;
}

.lake-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lake-gallery-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
}

.lake-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-xs);
}

.lake-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-light);
    font-size: var(--text-sm);
    margin-bottom: var(--space-lg);
}

.lake-type-badge {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    color: white;
}

.lake-weather {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-md);
    background: var(--background);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.weather-stat {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
}

.weather-stat svg {
    color: var(--text-light);
}

.lake-section {
    margin-bottom: var(--space-lg);
}

.lake-section h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
}

.fish-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.fish-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    background: var(--background);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
}

.fish-name {
    font-weight: 500;
}

.fish-weight {
    color: var(--text-light);
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
}

.contact-item svg {
    color: var(--text-light);
    flex-shrink: 0;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: var(--text-lg);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
}

/* Form Tabs */
.form-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--transition);
}

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

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-info {
    font-size: var(--text-sm);
    color: var(--text-light);
    margin-bottom: var(--space-md);
}

/* Fish Entry */
.fish-entry {
    position: relative;
    padding: var(--space-md);
    background: var(--background);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.btn-remove-fish {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

/* Photo Upload */
.photo-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    margin-bottom: var(--space-md);
}

.photo-upload-area:hover,
.photo-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(27, 67, 50, 0.05);
}

.upload-placeholder {
    color: var(--text-light);
}

.upload-placeholder svg {
    margin-bottom: var(--space-sm);
}

.photo-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

.photo-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-thumb .remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition);
}

.photo-thumb:hover .remove {
    opacity: 1;
}

/* ===== Leaflet Customization ===== */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
    width: var(--touch-target) !important;
    height: var(--touch-target) !important;
    line-height: var(--touch-target) !important;
    font-size: 1.25rem !important;
}

.leaflet-draw-toolbar a {
    width: var(--touch-target) !important;
    height: var(--touch-target) !important;
}

/* Lake polygons */
.lake-polygon-day_ticket { fill: var(--lake-day-ticket); }
.lake-polygon-syndicate { fill: var(--lake-syndicate); }
.lake-polygon-club { fill: var(--lake-club); }
.lake-polygon-private { fill: var(--lake-private); }
.lake-polygon-free { fill: var(--lake-free); }

/* Lake popup */
.lake-popup {
    min-width: 200px;
}

.lake-popup h3 {
    font-size: var(--text-base);
    margin-bottom: var(--space-xs);
}

.lake-popup p {
    font-size: var(--text-sm);
    color: var(--text-light);
    margin: 0;
}

.lake-popup .view-btn {
    display: block;
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--primary);
    color: white;
    text-align: center;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
}

.lake-popup .view-btn:hover {
    background: var(--primary-hover);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .header-center {
        display: none;
    }
    
    .user-name {
        display: none;
    }
    
    .sidebar {
        position: absolute;
        top: 64px;
        left: 0;
        height: calc(100% - 64px);
        z-index: 50;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .detail-panel {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 600px) {
    :root {
        --text-base: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-container {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.mb-0 { margin-bottom: 0; }
.mt-md { margin-top: var(--space-md); }
