/**
 * DigiPIN Integration Styles
 * Custom styles for DigiPIN search and layer controls
 */

/* DigiPIN Search Control */
.leaflet-control-digipin-search {
    background: white;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    margin: 10px;
    min-width: 280px;
    border: 1px solid #e0e0e0;
}

.leaflet-control-digipin-search:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.digipin-search-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 13px;
    font-family: 'Open Sans', sans-serif;
    transition: border-color 0.3s ease;
}

.digipin-search-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.digipin-search-input::placeholder {
    color: #999;
    font-style: italic;
}

.digipin-search-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #007cba 0%, #005a8b 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Open Sans', sans-serif;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.digipin-search-btn:hover {
    background: linear-gradient(135deg, #005a8b 0%, #004066 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.digipin-search-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.digipin-search-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.digipin-search-btn i {
    font-size: 12px;
}

.digipin-info {
    margin-top: 8px;
    font-size: 11px;
    color: #666;
    text-align: center;
    line-height: 1.4;
}

/* Tab Styles */
.digipin-tabs {
    display: flex;
    margin-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.digipin-tab {
    flex: 1;
    padding: 8px;
    background: #f8f9fa;
    color: #666;
    border: none;
    cursor: pointer;
    font-size: 11px;
    border-radius: 3px 3px 0 0;
    transition: all 0.3s ease;
}

.digipin-tab:hover {
    background: #e9ecef;
}

.digipin-tab.active {
    background: #007cba;
    color: white;
}

/* Panel Styles */
.digipin-panel {
    display: none;
}

.digipin-panel.active {
    display: block;
}

/* Generate Button */
.digipin-generate-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.digipin-generate-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.digipin-generate-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Coordinates Display */
.digipin-coords {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 3px;
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
}

/* DigiPIN Result Display */
.digipin-result {
    background: #e8f5e8;
    padding: 10px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.digipin-result button {
    background: #007cba;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    margin-top: 5px;
    transition: background 0.3s ease;
}

.digipin-result button:hover {
    background: #005a8b;
}

/* DigiPIN Grid Boundary Styles */
.digipin-grid-cell {
    transition: all 0.3s ease;
}

.digipin-grid-cell:hover {
    fill-opacity: 0.3 !important;
    opacity: 1 !important;
    stroke-width: 3px !important;
}

/* Grid Level Indicators */
.digipin-grid-3char {
    color: #45b7d1;
}

.digipin-grid-6char {
    color: #4ecdc4;
}

.digipin-grid-10char {
    color: #ff6b6b;
}

/* Map Click Mode Styles */
.leaflet-container.clickable {
    cursor: crosshair !important;
}

.leaflet-container.clickable:hover {
    cursor: crosshair !important;
}

.leaflet-container.clickable .leaflet-control-digipin-search {
    pointer-events: auto !important;
}

/* DigiPIN Marker Styles */
.digipin-marker {
    background: transparent !important;
}

.digipin-marker div {
    background: linear-gradient(135deg, #007cba 0%, #005a8b 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 40px;
    transition: all 0.3s ease;
}

.digipin-marker:hover div {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* DigiPIN Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-content {
    margin: 0;
    padding: 0;
}

.leaflet-popup-content h4 {
    margin: 0 0 12px 0;
    color: #007cba;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
}

.leaflet-popup-content p {
    margin: 8px 0;
    text-align: center;
}

.leaflet-popup-content .digipin-code {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    color: #007cba;
}

.leaflet-popup-content .coordinates {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.leaflet-popup-content button {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    transition: all 0.3s ease;
    width: 100%;
}

.leaflet-popup-content button:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* DigiPIN Layer Control */
.leaflet-control-layers-expanded .digipin-layer-control {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.leaflet-control-layers-expanded .digipin-layer-control:last-child {
    border-bottom: none;
}

.digipin-layer-control label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    margin: 0;
    padding: 4px 0;
}

.digipin-layer-control input[type="checkbox"] {
    margin: 0;
    accent-color: #007cba;
}

.digipin-layer-control .layer-info {
    font-size: 11px;
    color: #666;
    margin-left: 20px;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .leaflet-control-digipin-search {
        min-width: 250px;
        margin: 5px;
        padding: 10px;
    }

    .digipin-search-input {
        font-size: 12px;
        padding: 8px;
    }

    .digipin-search-btn {
        font-size: 12px;
        padding: 8px;
    }

    .digipin-info {
        font-size: 10px;
    }
}

/* Animation for loading states */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* Success/Error message animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.digipin-message {
    animation: slideIn 0.3s ease-out;
}

.digipin-message.fade-out {
    animation: slideOut 0.3s ease-in;
}

/* Accessibility improvements */
.digipin-search-input:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.digipin-search-btn:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .leaflet-control-digipin-search {
        border: 2px solid #000;
    }

    .digipin-search-input {
        border: 2px solid #000;
    }

    .digipin-search-btn {
        border: 2px solid #000;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .leaflet-control-digipin-search {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .digipin-search-input {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }

    .digipin-search-input::placeholder {
        color: #a0aec0;
    }

    .digipin-info {
        color: #a0aec0;
    }
}