/* web-styles.css */

:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #6b7280;
    --background-color: #f9fafb;
    --panel-background: #ffffff;
    --text-color: #1f2937;
    --light-text: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    overflow: hidden;
}

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

/* Control Panel - Desktop */
.control-panel {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 360px;
    max-height: calc(100% - 2rem);
    background: var(--panel-background);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
    z-index: 10;
}

.control-panel.collapsed {
    transform: translateX(calc(-100% + 50px));
}

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

.panel-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.panel-content {
    padding: 1rem;
    overflow-y: auto;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    box-sizing: border-box;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.filter-buttons {
    display: flex;
    gap: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.filter-button {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none;
    background: var(--panel-background);
    color: var(--text-color);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.filter-button.active {
    background: var(--primary-color);
    color: white;
}

.primary-button, .secondary-button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.primary-button:hover {
    background-color: var(--primary-dark);
}

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

.secondary-button:hover {
    background-color: #d1d5db;
}

.icon-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}

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

#toggleSidebar {
    transition: transform 0.3s ease;
}

.control-panel.collapsed #toggleSidebar {
    transform: rotate(180deg);
}

/* Results Panel */
.results-panel {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: none;
}

.results-panel.show {
    display: block;
}

.parking-info h3 {
    font-size: 1.1rem;
    margin-top: 0;
}

.parking-info p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.parking-info strong {
    color: var(--text-color);
}

.result-item {
    background: var(--background-color);
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.result-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.result-value {
    font-size: 1rem;
    color: var(--primary-color);
}

/* Mobile Panel */
.mobile-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--panel-background);
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    transform: translateY(calc(100% - 60px));
    z-index: 20;
}

.mobile-panel.expanded {
    transform: translateY(0);
}

.mobile-menu-button {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.5rem;
    box-shadow: var(--shadow);
}

.mobile-content {
    padding: 1.5rem 1rem 1rem;
    max-height: 80vh;
    overflow-y: auto;
}

.time-inputs {
    display: flex;
    gap: 1rem;
}

/* Map Overlays */
.warning-overlay {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: #fefce8;
    color: #ca8a04;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    z-index: 30;
    display: none;
    font-weight: 500;
}

.warning-overlay.error {
    background: #fee2e2;
    color: #b91c1c;
}

.map-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10;
}

.map-actions .icon-button {
    background: white;
    box-shadow: var(--shadow);
}

#refreshBtn {
    transition: transform 0.6s ease;
}

.color-key {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: white;
    padding: 0.75rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    z-index: 10;
}

.color-key-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.color-swatch {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    margin-right: 0.5rem;
    border: 1px solid var(--border-color);
}

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

/* Info Window */
.meter-info-window {
    font-family: var(--font-family);
    padding: 0.5rem;
}

.meter-info-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.meter-info-row {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.meter-info-row strong {
    color: var(--text-color);
}

.status-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
}

.status-free { background-color: #22c55e; }
.status-paid { background-color: #3b82f6; }
.status-restricted { background-color: #ef4444; }
.status-unknown { background-color: #6b7280; }
.status-tow_away { background-color: #f97316; }

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5em;
    vertical-align: middle;
}

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

/* Schedule Details */
.schedule-rule-line {
    margin-left: 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

.parking-info .schedule-details {
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.parking-info .schedule-details strong {
    display: block;
    margin-bottom: 0.25rem;
}

/* Responsive */
@media (max-width: 768px) {
    .control-panel {
        display: none;
    }
    .color-key {
        bottom: 70px;
    }
}

@media (min-width: 769px) {
    .mobile-panel {
        display: none;
    }
}