/**
 * Enhanced OSM Location Picker Styles
 *
 * @package OSM_Location_Picker
 */

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

/* Main Container Styles */
.osm-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
    margin: 20px 0;
    padding: 0;
}

.osm-container * {
    box-sizing: border-box;
}

/* Typography */
.osm-container h2,
.osm-container h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 500;
}

.osm-container p {
    margin-bottom: 15px;
    line-height: 1.6;
}

/* Map Container */
#osm-checkout-map,
#osm-order-map,
#osm-tracker-map,
.osm-map-container {
    width: 100%;
    height: 350px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* Button Styles */
.osm-container .button,
.osm-map-links a,
#generate-qr-btn,
#print-qr-btn {
    background: #2271b1;
    border: 1px solid #2271b1;
    color: white;
    padding: 8px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    text-decoration: none;
    display: inline-block;
    margin: 0 4px 4px 0;
    min-height: 32px;
    transition: all 0.2s ease;
}

.osm-container .button:hover,
.osm-map-links a:hover,
#generate-qr-btn:hover,
#print-qr-btn:hover {
    background: #135e96;
    border-color: #135e96;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.osm-container .button:active,
.osm-map-links a:active,
#generate-qr-btn:active,
#print-qr-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.osm-container .button.secondary {
    background: #f6f7f7;
    border-color: #2271b1;
    color: #2271b1;
}

.osm-container .button.secondary:hover {
    background: #f0f0f1;
    border-color: #0a4b78;
    color: #0a4b78;
}

/* Search Box Styles */
.osm-search-box {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.osm-search-box input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

.osm-search-box input[type="text"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* Metabox Container Styles */
.osm-metabox-container {
    margin-bottom: 20px;
    background: #fff;
    border-radius: 4px;
}

.osm-metabox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.osm-metabox-map-container {
    flex: 1 1 60%;
    min-width: 300px;
}

.osm-metabox-info-container {
    flex: 1 1 30%;
    min-width: 250px;
}

/* Map Links Styles */
.osm-map-links {
    margin: 15px 0;
}

.osm-map-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* QR Code Styles */
#osm-qr-code {
    margin: 15px 0;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: inline-block;
}

#osm-qr-code img {
    max-width: 150px;
    height: auto;
    display: block;
}

/* Order Tracker Form Styles */
#osm-tracker-form {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

#osm-tracker-form label {
    margin-right: 10px;
    font-weight: 500;
}

#osm-tracker-form input[type="number"] {
    width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

#osm-tracker-form input[type="number"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* Address Display */
#osm-address-display {
    font-style: italic;
    margin-top: 10px;
    padding: 8px;
    background: #f9f9f9;
    border-radius: 3px;
    font-size: 14px;
}

.osm-location-selected {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 6px;
    background: #e7f4e4;
    color: #2e7d32;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

/* Loading Indicator */
.loader-button {
    display: inline-block;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Access Denied Message */
.osm-access-denied {
    padding: 15px;
    background: #fff4f4;
    border-left: 4px solid #d63638;
    color: #973535;
}

/* Admin Page Styles */
.osm-settings-page {
    max-width: 900px;
    margin: 20px 0;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    font-family: "Poppins", sans-serif;
}

.osm-settings-page h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.osm-settings-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eaeaea;
}

.osm-settings-section h2 {
    color: #2c3e50;
    margin-top: 0;
}

.osm-settings-page .form-table th {
    width: 200px;
    padding: 20px 10px 20px 0;
    vertical-align: top;
    text-align: left;
}

.osm-settings-page .form-table td {
    padding: 15px 10px;
}

.osm-settings-page .button-primary {
    background: #3498db;
    border-color: #2980b9;
    color: white;
    padding: 5px 20px;
    height: auto;
    box-shadow: none;
    text-shadow: none;
}

.osm-settings-page .button-primary:hover {
    background: #2980b9;
}

.osm-settings-page input[type="text"],
.osm-settings-page input[type="number"],
.osm-settings-page select {
    width: 300px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Poppins', sans-serif;
}

.osm-settings-page input[type="checkbox"] {
    margin-right: 8px;
}

.osm-settings-page input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 1px #3498db;
}

.osm-settings-page label {
    display: inline-block;
    margin-bottom: 5px;
    font-weight: 400;
}

.osm-settings-page p.description {
    color: #7f8c8d;
    font-style: italic;
    margin-top: 5px;
    font-size: 13px;
}

/* WooCommerce Email Styles */
.osm-email-location-info {
    margin: 30px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.osm-email-location-info h2 {
    color: #333;
    font-size: 18px;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e9ecef;
}

.osm-email-button-container {
    margin: 20px 0;
    text-align: center;
}

.osm-email-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #3498db;
    color: white !important;
    text-decoration: none !important;
    border-radius: 4px;
    font-weight: bold;
}

/* Admin Order Metabox */
.osm-order-meta-box {
    padding: 12px;
    background: #fff;
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    margin-bottom: 20px;
}

.osm-order-meta-box h3 {
    font-size: 14px;
    padding: 8px 12px;
    margin: -12px -12px 12px;
    line-height: 1.4;
    border-bottom: 1px solid #c3c4c7;
    background: #f0f0f1;
}

/* Order Action Buttons */
.osm-order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.osm-order-actions button {
    flex: 0 0 auto;
}

/* Print Styling */
@media print {
    .print-qr-wrapper {
        padding: 30px;
        text-align: center;
    }
    
    .print-qr-wrapper h2 {
        margin-bottom: 20px;
        color: #000;
    }
    
    .print-qr-wrapper img {
        width: 300px;
        height: auto;
        margin: 20px auto;
    }
    
    .print-qr-wrapper .info {
        text-align: left;
        margin: 20px auto;
        max-width: 400px;
        padding: 20px;
        background: #f8f9fa;
        border-radius: 8px;
    }
}

/* RTL Support */
.rtl .osm-container .button,
.rtl .osm-map-links a,
.rtl #generate-qr-btn,
.rtl #print-qr-btn {
    margin: 0 0 4px 4px;
}

.rtl .osm-form-row label {
    text-align: right;
}

.rtl .osm-map-links {
    text-align: right;
}

.rtl .osm-access-denied {
    border-left: none;
    border-right: 4px solid #d63638;
}

.rtl .osm-settings-page .form-table th {
    text-align: right;
}

/* Persian/Farsi font support */
.rtl.fa-IR .osm-container,
.rtl.fa-IR .osm-settings-page {
    font-family: Vazir, Tahoma, Arial, sans-serif;
}

/* Arabic font support */
.rtl.ar .osm-container,
.rtl.ar .osm-settings-page {
    font-family: 'Droid Arabic Kufi', Tahoma, Arial, sans-serif;
}

/* Admin Notices */
.osm-settings-page .notice {
    background-color: #f8f9fa;
    border-right: 4px solid;
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.osm-settings-page .notice p {
    margin: 0;
    padding: 0;
}

.osm-settings-page .notice-success {
    border-right-color: #2ecc71;
    background-color: #e8f8f2;
}

.osm-settings-page .notice-warning {
    border-right-color: #f39c12;
    background-color: #fef8e8;
}

.osm-settings-page .notice-error {
    border-right-color: #e74c3c;
    background-color: #fdeaea;
}

/* Responsive Adjustments */
@media screen and (max-width: 782px) {
    .osm-settings-page input[type="text"],
    .osm-settings-page input[type="number"],
    .osm-settings-page select {
        width: 100%;
        max-width: none;
    }
    
    .osm-settings-page .form-table th {
        width: 100%;
        display: block;
        padding-bottom: 0;
        text-align: right;
    }
    
    .osm-settings-page .form-table td {
        width: 100%;
        display: block;
        padding-top: 5px;
    }
    
    .osm-metabox-row {
        flex-direction: column;
    }
    
    .osm-search-box {
        flex-direction: column;
    }
    
    .osm-search-box input[type="text"] {
        width: 100%;
    }
    
    #osm-checkout-map,
    #osm-order-map,
    #osm-tracker-map,
    .osm-map-container {
        height: 300px;
    }
    
    #osm-tracker-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    #osm-tracker-form input[type="number"] {
        width: 100%;
    }
}