/* Network Map Dashboard - CSS */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Coltact Brand Colors - כתום קולטאקט */
    --brand-orange: #F7931E;
    --brand-orange-dark: #E07D0D;
    --brand-orange-light: #FFB347;

    /* Colors */
    --primary: #F7931E;
    --primary-dark: #E07D0D;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    /* Status Colors */
    --status-active: #22c55e;
    --status-available: #94a3b8;
    --status-maintenance: #f59e0b;
    --status-pole: #D2956B;

    /* Background - Dark Professional */
    --bg-primary: #0a0e17;
    --bg-secondary: #141b2d;
    --bg-card: #1f2940;
    --bg-hover: #2d3a52;

    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Borders */
    --border-color: #2d3a52;
    --border-radius: 12px;
    --border-radius-sm: 8px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(247, 147, 30, 0.3);

    /* Transitions */
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Heebo', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 60px;
}

/* Header */
.header {
    background: var(--bg-secondary);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1800px;
    margin: 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.logo-img {
    height: 70px;
    width: auto;
    object-fit: contain;
    filter: brightness(1.1);
}

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

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

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

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

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

.btn-ai {
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-ai:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 0 30px rgba(247, 147, 30, 0.5);
}

.btn-back {
    background: var(--bg-card);
    color: var(--text-secondary);
}

.btn-back:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

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

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

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

.btn-reset {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

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

/* Statistics Bar */
.stats-bar {
    display: flex;
    gap: 1rem;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius-sm);
    min-width: 150px;
    cursor: pointer;
    transition: var(--transition);
}

.stat-card:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 1.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 1rem;
    padding: 1rem 2rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.filter-group select,
.filter-group input {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    min-width: 150px;
}

.filter-group.search input {
    min-width: 200px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Main Map Container */
.map-container {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
}

/* Mokadim Rows */
.mokadim-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.moked {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1rem;
    min-width: 120px;
    flex: 1;
    max-width: 180px;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.moked:hover {
    border-color: var(--brand-orange);
    box-shadow: var(--shadow-glow);
}

.moked-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.moked-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    margin-bottom: 0.25rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    padding: 2px;
}

.moked-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--brand-orange);
}

.moked-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.stations-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

/* Row indicator stripes removed - stations only colored by status */

/* Stations */
.station {
    aspect-ratio: 1;
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    position: relative;
    min-height: 45px;
    font-size: 0.65rem;
}

.station:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: var(--shadow-lg);
}

/* Station status - only border and status indicator, no background color */
.station.active {
    border-color: var(--status-active);
}

.station.available {
    border-color: transparent;
}

.station.maintenance {
    border-color: var(--status-maintenance);
}

.station.broken {
    border-color: #ef4444;
}

.station.pole {
    border-color: var(--status-pole);
}

.station-number {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.7rem;
}

.station-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: absolute;
    top: 4px;
    left: 4px;
}

.station-status.active {
    background: var(--status-active);
}

.station-status.available {
    background: var(--status-available);
}

.station-status.maintenance {
    background: var(--status-maintenance);
}

.station-status.pole {
    background: var(--status-pole);
}

.station-status.broken {
    background: #ef4444;
}

.station-employee {
    font-size: 0.5rem;
    color: var(--text-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.station-points {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}

.point-indicator {
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--status-available);
}

.point-indicator.active {
    background: var(--status-active);
}

.point-indicator.maintenance {
    background: var(--status-maintenance);
}

/* Bamot (Platforms) */
.bamot-row {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 1.5rem 0;
}

.bama {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1rem;
    border: 2px solid var(--info);
    min-width: 200px;
}

.bama-header {
    text-align: center;
    font-weight: 700;
    color: var(--info);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
}

.bama-header:hover {
    color: var(--primary);
    background: rgba(247, 147, 30, 0.1);
    border-radius: var(--border-radius-sm);
}

.bama-stations {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

/* Legend Panel */
.legend-panel {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    border: 1px solid var(--border-color);
    border-left: none;
    max-width: 200px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 50;
    box-shadow: var(--shadow-lg);
}

.legend-panel h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.legend-section {
    margin-bottom: 1rem;
}

.legend-section h4 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-color.status-active {
    background: var(--status-active);
}

.legend-color.status-available {
    background: var(--status-available);
}

.legend-color.status-maintenance {
    background: var(--status-maintenance);
}

.legend-color.status-pole {
    background: var(--status-pole);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-large {
    max-width: 700px;
}

.modal-content.modal-chat {
    max-width: 600px;
    height: 70vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

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

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
}

/* Station Modal */
.station-info {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.info-row label {
    color: var(--text-muted);
}

.info-row span {
    font-weight: 600;
    color: var(--text-primary);
}

.station-type-selector {
    margin-bottom: 1.5rem;
}

.station-type-selector label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.type-buttons {
    display: flex;
    gap: 0.5rem;
}

.type-btn {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

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

.type-btn.active {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.2);
}

.network-points {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.network-point {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.network-point h4 {
    margin-bottom: 0.75rem;
    color: var(--brand-orange);
    font-size: 0.9rem;
}

.point-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.field label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.field input,
.field select {
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

/* Legend Modal */
.legend-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-card);
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

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

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

.tab-content {
    display: none;
}

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

.legend-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.legend-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
}

.legend-list-item .item-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.legend-list-item .item-info {
    flex: 1;
}

.legend-list-item .item-name {
    font-weight: 500;
}

.legend-list-item .item-id {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-list-item .item-actions {
    display: flex;
    gap: 0.25rem;
}

.legend-list-item button {
    padding: 0.25rem 0.5rem;
    background: var(--bg-hover);
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
}

.legend-list-item button:hover {
    background: var(--danger);
    color: white;
}

.add-item {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    flex-wrap: wrap;
}

.add-item input {
    flex: 1;
    min-width: 100px;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
}

.add-item input[type="color"] {
    width: 50px;
    padding: 0;
    cursor: pointer;
}

/* Chat Modal */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
}

.chat-message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
}

.chat-message.ai {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-primary);
}

.chat-message ul {
    margin-top: 0.5rem;
    padding-right: 1.5rem;
}

.chat-message li {
    margin: 0.25rem 0;
}

.chat-input {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.chat-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Moked Stats Modal */
.moked-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.moked-stat-item {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    text-align: center;
}

.moked-stat-item .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--brand-orange);
}

.moked-stat-item .stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-overlay.active .modal-content {
    animation: slideUp 0.3s ease;
}

/* Responsive */
@media (max-width: 1400px) {
    .moked {
        min-width: 100px;
        max-width: 150px;
    }
}

@media (max-width: 1200px) {
    .mokadim-row {
        flex-wrap: wrap;
    }

    .moked {
        flex: 0 0 calc(25% - 1rem);
        max-width: none;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-bar {
        justify-content: flex-start;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select,
    .filter-group input {
        width: 100%;
    }

    .moked {
        flex: 0 0 calc(50% - 0.5rem);
    }

    .bamot-row {
        flex-direction: column;
        align-items: center;
    }

    .legend-panel {
        position: relative;
        transform: none;
        max-width: none;
        border-radius: var(--border-radius);
        border: 1px solid var(--border-color);
        margin: 1rem;
    }

    .point-fields {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Hidden state for filtered elements */
.station.hidden,
.moked.hidden {
    display: none;
}

/* Highlight on search */
.station.highlight {
    animation: pulse 1s ease infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
}

/* Values Icons Bar - Coltact Values */
.values-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: transparent;
    flex-wrap: nowrap;
}

.values-bar-top {
    /* Icons above header - compact */
    background: var(--bg-secondary);
    padding: 0.3rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.values-bar-top .value-icon-wrapper {
    width: 45px;
    height: 45px;
}

.values-bar-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-secondary);
    padding: 0.3rem 1rem;
    border-top: 1px solid var(--border-color);
}

.values-bar-bottom .value-icon-wrapper {
    width: 45px;
    height: 45px;
}

.value-icon-wrapper {
    width: 45px;
    height: 45px;
    overflow: hidden;
    border-radius: 50%;
    transition: var(--transition);
    background: transparent;
}

.value-icon-wrapper:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 0 10px rgba(247, 147, 30, 0.7));
}

.value-icon {
    width: 100%;
    height: auto;
    margin-top: -5%;
    filter: brightness(1.1);
}

.value-icon:hover {
    filter: brightness(1.3);
}

/* Responsive values bar */
@media (max-width: 1200px) {
    .values-bar {
        gap: 0.5rem;
        padding: 0.3rem 0.5rem;
    }

    .value-icon-wrapper {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 768px) {
    .values-bar {
        gap: 0.3rem;
        padding: 0.2rem 0.3rem;
    }

    .value-icon-wrapper {
        width: 50px;
        height: 50px;
    }

    .values-bar-header {
        display: none;
    }
}

