/* ===== CSS Variables & Design System ===== */
:root {
    /* Colors - Vibrant & Modern Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #f093fb;
    --accent-color: #4facfe;
    
    /* Neutral Colors */
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #252541;
    --surface: rgba(255, 255, 255, 0.05);
    --surface-hover: rgba(255, 255, 255, 0.08);
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b8b8d1;
    --text-muted: #7c7c9a;
    
    /* Borders & Shadows */
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --glow: 0 0 20px rgba(102, 126, 234, 0.3);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

/* ===== App Container ===== */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    background: var(--bg-secondary);
    padding: var(--spacing-lg) var(--spacing-xl);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 1000;
}

.header-content h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.logo-icon {
    width: 32px;
    height: 32px;
    stroke: var(--primary-color);
    filter: drop-shadow(var(--glow));
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-left: 40px;
}

.header-actions {
    display: flex;
    gap: var(--spacing-md);
}

/* ===== Buttons ===== */
.btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    transition: all var(--transition-base);
    font-family: var(--font-primary);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 400px;
    overflow: hidden;
}

/* ===== Map Section ===== */
.map-section {
    position: relative;
    background: var(--bg-secondary);
}

.map-container {
    width: 100%;
    height: 100%;
}

.map-instructions {
    position: absolute;
    bottom: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    z-index: 500;
    animation: fadeInUp 0.5s ease;
}

.map-instructions svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent-color);
}

/* ===== Tips Panel ===== */
.tips-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.tip-count {
    background: var(--surface);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ===== Tip Form ===== */
.tip-form {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    animation: slideDown 0.3s ease;
}

.tip-form.hidden {
    display: none;
}

.tip-form h3 {
    font-size: 1rem;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    transition: all var(--transition-base);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.coordinates-display {
    background: var(--surface);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.coordinates-display label {
    margin-bottom: var(--spacing-xs);
}

.coordinates-display span {
    color: var(--accent-color);
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}

.form-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.form-actions .btn {
    flex: 1;
}

/* ===== Tips List ===== */
.tips-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.tips-list::-webkit-scrollbar {
    width: 8px;
}

.tips-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.tips-list::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: 4px;
}

.tips-list::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

/* ===== Tip Card ===== */
.tip-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    transition: all var(--transition-base);
    animation: fadeIn 0.3s ease;
    cursor: pointer;
}

.tip-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.tip-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.tip-location {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.tip-location svg {
    width: 16px;
    height: 16px;
    stroke: var(--primary-color);
}

.tip-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.tip-actions button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.tip-actions button svg {
    width: 16px;
    height: 16px;
}

.edit-btn svg {
    stroke: var(--accent-color);
}

.delete-btn svg {
    stroke: #f87171;
}

.tip-actions button:hover {
    background: var(--surface);
}

.tip-content {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: var(--spacing-sm);
}

.tip-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

.tip-coordinates {
    font-family: 'Courier New', monospace;
}

/* ===== Empty State ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-muted);
    height: 100%;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    stroke: var(--text-muted);
    margin-bottom: var(--spacing-lg);
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
    margin-bottom: var(--spacing-xs);
}

.empty-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* ===== Leaflet Customization ===== */
.leaflet-popup-content-wrapper {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-tip {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.leaflet-popup-content {
    margin: var(--spacing-md);
    font-family: var(--font-primary);
}

.popup-location {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.popup-content {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr 350px;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 60% 40%;
    }
    
    .tips-panel {
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    .header {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .tagline {
        margin-left: 0;
    }
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    background-image: radial-gradient(circle at 50% 0%, var(--bg-tertiary) 0%, var(--bg-primary) 70%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: var(--spacing-md);
}

.login-box {
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg), var(--glow);
    animation: fadeInUp 0.5s ease;
}

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

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.login-form .btn-block {
    width: 100%;
    justify-content: center;
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
}

.login-message {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-top: var(--spacing-md);
    text-align: center;
}

.login-message.hidden {
    display: none;
}

.login-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.login-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.login-footer {
    margin-top: var(--spacing-lg);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}
