* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tahoma', 'Arial', sans-serif;
}

body {
    background: #f5f5f5;
    direction: rtl;
    text-align: right;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
}

/* صفحه لاگین */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    background: white;
    padding: 30px 25px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.login-box h2 {
    text-align: center;
    color: #666;
    font-size: 16px;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: bold;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-login:hover {
    transform: scale(1.02);
}

.btn-login:active {
    transform: scale(0.98);
}

.error-msg {
    color: #f44336;
    margin-top: 10px;
    text-align: center;
}

/* نقشه */
#map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

/* دکمه‌های کنترلی */
.map-controls {
    position: fixed;
    bottom: 30px;
    right: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ctrl-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.ctrl-btn:active {
    transform: scale(0.9);
}

/* فرم تمام صفحه */
.fullscreen-form {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.form-content {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 95vh;
    border-radius: 16px;
    padding: 20px;
    overflow-y: auto;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease;
    position: relative;
}

.close-form {
    position: sticky;
    top: 0;
    float: left;
    background: #f44336;
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    margin-bottom: 15px;
    z-index: 10;
}

.form-content h2 {
    color: #333;
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
    font-size: 20px;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
}

.btn-secondary {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

/* بخش عکس‌ها */
.photos-section {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 10px;
}

.photo-group {
    margin-bottom: 15px;
}

.photo-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

.photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.photo-preview .photo-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #ddd;
}

.photo-preview.small .photo-item {
    width: 80px;
    height: 80px;
}

.photo-preview.large .photo-item {
    width: 200px;
    height: 200px;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.delete-photo {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #f44336;
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
}

/* شیرآلات */
.valves-section {
    margin: 20px 0;
    padding: 15px;
    background: #f0f7ff;
    border-radius: 10px;
}

.valve-icon {
    transition: transform 0.2s;
}

.valve-icon:hover {
    transform: scale(1.2);
}

/* استایل پاپ‌آپ */
.point-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
    padding: 10px;
}

.point-popup-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: slideUp 0.3s;
}

.point-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.point-popup-header h3 {
    margin: 0;
    font-size: 17px;
    color: #333;
}

.popup-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0 8px;
}

.popup-close-btn:hover {
    color: #333;
}

.point-popup-body {
    padding: 16px;
}

/* اطلاعات نقطه */
.point-info {
    margin-bottom: 18px;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
}

.info-row {
    display: flex;
    margin: 6px 0;
    gap: 8px;
    font-size: 14px;
}

.info-label {
    font-weight: bold;
    color: #555;
    min-width: 70px;
}

.info-value {
    color: #333;
    word-break: break-word;
}

/* دکمه‌های اکشن */
.point-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.action-btn {
    padding: 12px 10px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.action-btn:active {
    transform: scale(0.95);
}

.action-visible {
    background: #4CAF50;
    color: white;
}

.action-buried {
    background: #FF9800;
    color: white;
}

.action-locked {
    background: #f44336;
    color: white;
}

.action-no-chamber {
    background: #9E9E9E;
    color: white;
}

.action-delete {
    background: #d32f2f;
    color: white;
    grid-column: 1 / -1;
}

/* بخش آپلود عکس */
.photo-upload-section h4 {
    margin: 0 0 14px 0;
    color: #333;
    font-size: 16px;
}

.photo-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.photo-btn {
    padding: 10px 14px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex: 1;
    min-width: 70px;
    font-size: 13px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.photo-btn:active {
    background: #1976D2;
}

.photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0;
    min-height: 60px;
}

.photo-item {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #ddd;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 9px;
    text-align: center;
    padding: 2px;
}

.photo-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255,0,0,0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    cursor: pointer;
    touch-action: manipulation;
}

.photo-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.photo-actions button {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex: 1;
    font-size: 14px;
    touch-action: manipulation;
}

.back-btn {
    background: #e0e0e0;
    color: #333;
}

.confirm-photos-btn {
    background: #4CAF50;
    color: white;
}

/* انیمیشن‌ها */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* مودال شیرها */
.valve-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 8px;
}

.valve-modal-content {
    background: white;
    width: 100%;
    max-width: 800px;
    max-height: 95vh;
    border-radius: 12px;
    padding: 15px;
    overflow-y: auto;
    position: relative;
}

.valve-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.valve-modal-header h3 {
    font-size: 17px;
    margin: 0;
}

.valve-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 0 8px;
}

.valve-modal-body {
    padding-top: 12px;
}

.valve-modal-body #valveMap {
    width: 100% !important;
    height: 300px !important;
    border-radius: 8px;
    overflow: hidden;
}

.valve-actions {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    flex-wrap: wrap;
}

.valve-actions button {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
}

.btn-add-valve {
    background: #2196F3;
    color: white;
}

.btn-no-valve {
    background: #9E9E9E;
    color: white;
}

.valve-modal-footer {
    margin-top: 12px;
}

.btn-confirm-valve {
    width: 100%;
    padding: 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
}

/* استایل Wizard */
.wizard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 8px;
}

.wizard-content {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 95vh;
    border-radius: 12px;
    padding: 20px;
    overflow-y: auto;
    position: relative;
}

.wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 2px solid #667eea;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.wizard-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.wizard-step {
    background: #667eea;
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
}

.wizard-body {
    min-height: 200px;
}

.wizard-step-content .form-group {
    margin-bottom: 16px;
}

.wizard-step-content label {
    display: block;
    font-weight: bold;
    margin-bottom: 4px;
    color: #555;
    font-size: 14px;
}

.wizard-step-content input,
.wizard-step-content select,
.wizard-step-content textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    -webkit-appearance: none;
    appearance: none;
    background: white;
}

.wizard-step-content input:focus,
.wizard-step-content select:focus,
.wizard-step-content textarea:focus {
    border-color: #667eea;
    outline: none;
}

.wizard-footer {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

.wizard-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    touch-action: manipulation;
    flex: 1;
    min-width: 80px;
}

.wizard-prev {
    background: #e0e0e0;
    color: #333;
}

.wizard-prev:active {
    background: #d0d0d0;
}

.wizard-next {
    background: #667eea;
    color: white;
}

.wizard-next:active {
    background: #5a6fd6;
}

.wizard-submit {
    background: #4CAF50;
    color: white;
}

.wizard-submit:active {
    background: #45a049;
}

.wizard-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #999;
    padding: 0 8px;
}

.wizard-close:hover {
    color: #333;
}

/* واکنش‌گرا */
@media (max-width: 600px) {
    .point-actions {
        grid-template-columns: 1fr 1fr;
    }
    
    .photo-buttons {
        flex-direction: row;
    }
    
    .photo-item {
        width: 60px;
        height: 60px;
    }
    
    .valve-modal-body #valveMap {
        height: 250px !important;
    }
    
    .map-controls {
        bottom: 20px;
        right: 10px;
        gap: 8px;
    }
    
    .ctrl-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .point-popup-content {
        max-width: 100%;
        margin: 0 5px;
    }
    
    .wizard-content {
        padding: 15px;
    }
    
    .valve-modal-content {
        padding: 12px;
    }
    
    .login-box {
        padding: 25px 20px;
    }
}

@media (max-width: 400px) {
    .point-actions {
        grid-template-columns: 1fr;
    }
    
    .valve-actions button {
        min-width: 100%;
    }
    
    .wizard-footer button {
        flex: 1 1 100%;
    }
    
    .photo-btn {
        min-width: 60px;
        font-size: 12px;
        padding: 8px 10px;
    }
    
    .valve-modal-body #valveMap {
        height: 200px !important;
    }
}

/* بهبود تاچ در موبایل */
button,
.ctrl-btn,
.action-btn,
.photo-btn,
.wizard-footer button,
.valve-actions button,
.btn-confirm-valve {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* اسکرول نرم */
.point-popup-content,
.wizard-content,
.valve-modal-content,
.form-content {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

#uploadProgress {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 4px;
    margin: 10px 0;
    overflow: hidden;
}

#progressBar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 4px;
    transition: width 0.3s ease;
}