/*
 * Iran Map - SVG and Responsive.
 * Free and open source.
 * Version 1.1.0
 * By: MohammadReza Pourmohammad.
 * Email: mohammadrpm@gmail.com
 * Web: http://mrpm.ir
 * --- MODIFIED FOR RESPONSIVENESS ---
 */

#IranMap {
    display: block;
    position: relative;
    direction: rtl;
    text-align: center;
    padding: 0;
    font-family: Tahoma;
    font-size: 11px;
    /* Changed: Use max-width for better responsiveness */
    width: 100%;
    max-width: 900px; /* می‌توانید این مقدار را تغییر دهید */
    margin: 50px auto;
}

#IranMap .show-title {
    display: none;
    position: absolute;
    background-color: #333;
    color: #fff;
    margin: 0 !important;
    padding: 0 5px;
    text-align: center;
    line-height: 26px;
    border-radius: 2px;
    -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
    opacity: 0.8;
}

/* --- START: RESPONSIVE MAP CONTAINER --- */
#IranMap .map {
    display: block;
    /* Changed: Remove float to work with modern layouts like Bootstrap grid */
    float: none;
    width: 100%;
    text-align: center;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* Added: margin for spacing when list is below on mobile */
    margin-bottom: 20px;
}

/* CRITICAL CHANGE: Make SVG responsive */
#IranMap .map svg {
    /* Remove fixed dimensions */
    /* height: 500px; */
    /* width: 500px; */

    /* Make SVG scale with its container */
    width: 100%;
    height: auto;
    max-height: 500px; /* Optional: cap the maximum height */
}
/* --- END: RESPONSIVE MAP CONTAINER --- */


#IranMap .map .border path,
#IranMap .map .island path {
    fill: #fff;
}

#IranMap .map .province path {
    fill: #999;
}

#IranMap .map .sea path,
#IranMap .map .lake path {
    fill: #6caed8;
}

#IranMap .map .province path:hover,
#IranMap .map .island path:hover,
#IranMap .map .province path.hover,
#IranMap .map .island path.hover {
    fill: #c33a2c !important;
    cursor: pointer;
}

#IranMap .list {
    display: block;
    /* Changed: Remove float */
    float: none;
    width: 100%;
}

#IranMap .list ul {
    padding: 0;
}

#IranMap .list>ul {
    /* This margin is for the old float layout, can be removed or adjusted */
    margin-left: 0;
}

#IranMap .list li {
    list-style: none;
}

#IranMap .list span {
    background: #242424;
    color: #ecf0f1;
    display: block;
    margin: 0 2px;
    padding: 10px 8px;
    line-height: 26px;
    margin-top: 10px;
    margin-bottom: 2px;
    font-weight: bold;
}

/* --- START: RESPONSIVE LIST --- */
#IranMap .list li ul li {
    display: block;
    float: right;
    /* Default: 3 columns on larger screens */
    width: 33.33333333333333%;
}

#IranMap .list li ul li a {
    background: #34495e;
    color: #ecf0f1;
    display: block;
    padding: 5px 8px;
    line-height: 26px;
    margin: 2px 2px;
    text-decoration: none;
    /* Added: prevent text from breaking awkwardly */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#IranMap .list li ul li a:hover,
#IranMap .list li ul li a.hover {
    background: #c33a2c;
}

#IranMap .list ul:before,
#IranMap .list ul:after {
    display: table;
    content: " ";
}

#IranMap .list ul,
#IranMap .list ul:after {
    clear: both;
}

#IranMap .city {
    clear: both;
    padding: 10px 0;
}

/* --- START: MEDIA QUERIES (REVISED) --- */

/* Tablets and smaller (Bootstrap 'md' breakpoint) */
@media(max-width: 768px) {
    #IranMap .list li ul li {
        /* 2 columns on medium screens */
        width: 50%;
    }
    #IranMap .list li ul li a {
        font-size: 12px;
    }
}

/* Small phones (Bootstrap 'sm' breakpoint) */
@media(max-width: 576px) {
    #IranMap .list li ul li {
        /* 1 column on small screens */
        width: 100%;
    }
    #IranMap .list li ul li a {
        font-size: 13px; /* Can be a bit bigger when it's full width */
        white-space: normal; /* Allow text to wrap */
        overflow: visible;
        text-overflow: clip;
    }
}

/* --- END: MEDIA QUERIES (REVISED) --- */

/* --- END: RESPONSIVE LIST --- */
