/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    /*align-items: center;*/
    align-items: flex-end;
    z-index: 10002;
    backdrop-filter: blur(3px);
    font-family: 'MedievalSharp', cursive;

.modal-close {
    position: absolute;
    bottom: 30px;
    font-size: 15px;
    padding: 10px;
    border-radius: 5px;
    color: #e8c070;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.modal-close:hover {
    background: linear-gradient(to bottom, #6a4a31, #4d3828);
    color: #fff;
}

.modal-close-btn {
    margin-top: 20px;
    top: 12px;
    right: 12px;
    min-width: 92px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #8b4513;
    border-radius: 6px;
    background: linear-gradient(to bottom, #5a3921, #3d2818);
    color: #e8c070;
    font-family: 'MedievalSharp', cursive;
    font-size: 13px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: linear-gradient(to bottom, #6a4a31, #4d3828);
    color: #fff;
}

.modal-content {
    background: linear-gradient(to bottom, rgba(58, 44, 26, 0.95), rgba(26, 13, 10, 0.95));
    border-radius: 8px;
    border: 1px solid #482f10;
    width: 100%;
    padding: 20px;
    max-width: 600px;
    margin: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
    color: #f0e6d2;
    overflow: auto;
    max-height: 75%;
    bottom: 70px;
}
.modal-title {
    color: #e8c070;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid #482f10;
    padding-bottom: 10px;
}

.detail-label {
    font-weight: bold;
    color: #c0b080;
    display: inline-block;
    width: 120px;
    margin-right: 10px;
}

.detail-value {
    color: #f0e6d2;
    display: inline-block;
}

.modal-body {
    &.text-center {
        text-align: center;
    }
}

.modal-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #482f10;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.modal-btn {
    border: 1px solid #482f10;
    background: linear-gradient(180deg, #3b250c 0%, #5f3c19 100%);
    color: #f0e6d2;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'MedievalSharp', cursive;
    transition: all 0.2s;
}

.modal-btn:hover {
    background: linear-gradient(to bottom, #6a4a31, #4d3828);
    color: #fff;
}

.modal-btn-primary {
    background: linear-gradient(to bottom, #8b4513, #5a3921);
}

.modal-btn-primary:hover {
    background: linear-gradient(to bottom, #9a5529, #6a4a31);
}

/* Анимация */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптация для мобильных */
@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        padding: 15px;
    }

    .detail-label {
        width: 100px;
        display: block;
        margin-bottom: 5px;
    }

    .modal-title {
        font-size: 1.3rem;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }
}















.hex-info {
    font-family: 'MedievalSharp', cursive;
    color: #f0e6d2;
    padding: 15px;
    position: relative;
}

.hex-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #5a3921;
    margin-bottom: 15px;
}

.hex-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    border-bottom: 1px solid #5a3921;
    padding-bottom: 8px;
}

.hex-coords {
    color: #e8c070;
    font-weight: bold;
}

.hex-type {
    background: rgba(139, 69, 19, 0.3);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.9em;
}

.hex-description {
    margin: 12px 0;
    line-height: 1.4;
    font-size: 0.95em;
}

.hex-content {
    background: rgba(40, 30, 20, 0.5);
    padding: 10px;
    border-radius: 6px;
    margin: 15px 0;
    border-left: 3px solid #8b4513;
}

.hex-actions {
    margin-top: 20px;
}

.action-item {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(58, 44, 26, 0.3);
    border: 1px solid #482f10;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    &.disabled {
        opacity: 0.6;
    }
}

.action-icon {
    font-size: 1.2em;
    min-width: 24px;
    text-align: center;
}

.action-content {
    flex-grow: 1;
}

.action-name {
    color: #e8c070;
    font-weight: bold;
    margin-bottom: 3px;
}

.action-desc {
    font-size: 0.85em;
    color: #c0b080;
}











/* Inventory Item Modal Styles */
.inventory-modal {
    font-family: 'MedievalSharp', cursive;
    color: #f0e6d2;
}

.modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #5a3921;
    position: relative;
    &.flex-column {
        flex-direction: column;
        .item-icon img {
            width: 100%;
            max-width: 100px;
        }
    }
}


.item-icon {
    font-size: 2.5rem;
    margin-right: 15px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    min-width: 50px;
    text-align: center;
}

.item-name {
    color: #e8c070;
    font-size: 1.5rem;
    margin: 0;
    flex-grow: 1;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.item-rarity {
    padding: 3px 10px;
    font-size: 1em;
    text-transform: capitalize;

}

/* Rarity-specific colors */
.item-rarity.common { color: #b0b0b0; }
.item-rarity.uncommon { color: #2ecc71; }
.item-rarity.rare { color: #3498db; }
.item-rarity.epic { color: #9b59b6; }
.item-rarity.legendary { color: #f1c40f; }

.item-stats {
    display: flex;
    gap: 10px;
    background: rgba(40, 30, 20, 0.5);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 3px solid #8b4513;
}

.item-stats div {
    display: flex;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.item-stats div:last-child {
    margin-bottom: 0;
}

.item-stats span {
    color: #c0b080;
    min-width: 100px;
    display: inline-block;
}

.item-description {
    font-style: italic;
    line-height: 1.4;
    padding: 12px;
    background: rgba(58, 44, 26, 0.3);
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 3px solid #8b4513;
}

.item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.item-actions .action-button {
    flex: 1 1 0;
    min-width: 120px;
}

.item-actions .move-btn {
    flex-basis: 100%;
}

.action-button {
    background: linear-gradient(to bottom, #5a3921, #3d2818);
    border: 1px solid #8b4513;
    color: #f0e6d2;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'MedievalSharp', cursive;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
}

.action-button:hover {
    background: linear-gradient(to bottom, #6a4a31, #4d3828);
    transform: translateY(-2px);
}

.action-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.action-name {
    font-weight: bold;
    margin-bottom: 3px;
}

.action-description {
    font-size: 0.8em;
    color: #c0b080;
}

/* Special buttons */
.use-btn {
    background: linear-gradient(to bottom, #3a5a20, #2d4218);
    border-color: #5a8c2e;
}

.equip-btn {
    background: linear-gradient(to bottom, #1a3a5a, #142d42);
    border-color: #2e5a8c;
}

.drop-btn {
    background: linear-gradient(to bottom, #5a1a1a, #421414);
    border-color: #8c2e2e;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .modal-header {
        flex-direction: column;
        text-align: center;
    }

    .item-icon {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .item-stats div {
        flex-direction: column;
    }

    .item-stats span {
        min-width: auto;
        margin-bottom: 3px;
    }

    .item-actions {
        flex-direction: row;
    }
}

/* Animation for item rarity glow */
@keyframes glow {
    0% { box-shadow: 0 0 5px currentColor; }
    50% { box-shadow: 0 0 20px currentColor; }
    100% { box-shadow: 0 0 5px currentColor; }
}

}

/* ----- hex-edit-form ----- */


/* Декоративная линия сверху */
.hex-edit-form::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 20px;
    right: 20px;
    height: 5px;
    background: linear-gradient(90deg, transparent 10%, #e0a84b 10%, #e0a84b 90%, transparent 90%);
    border-radius: 5px;
}

/* Заголовок */
.hex-edit-form h3 {
    margin: 0 0 20px 0;
    font-size: 24px;
    text-shadow: 2px 2px 4px #000;
    letter-spacing: 1px;
    color: #f8d070;
    font-weight: normal;
    text-align: center;
    border-bottom: 2px solid #5a3921;
    padding-bottom: 10px;
}

/* Fieldset */
.hex-edit-form fieldset {
    border: 1px solid #5a3921;
    border-radius: 10px;
    margin: 15px 0;
    padding: 15px 18px;
    background: rgba(58, 44, 26, 0.5);
}

.hex-edit-form legend {
    font-size: 1.1rem;
    font-weight: bold;
    color: #e8c070;
    text-shadow: 1px 1px 2px #000;
    padding: 3px 10px;
    border-radius: 6px;
    background: linear-gradient(to bottom, rgba(139, 69, 19, 0.8), rgba(90, 57, 33, 0.8));
    border: 1px solid #5a3921;
}

/* Метки */
.hex-edit-form label {
    display: block;
    margin: 10px 0;
    color: #e0a84b;
    font-size: 15px;
    text-shadow: 1px 1px 2px #000;
}

/* Инпуты и селекты */
.hex-edit-form input,
.hex-edit-form select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #5c3a21;
    border-radius: 8px;
    color: #f0e6d2;
    font-family: 'MedievalSharp', cursive;
    font-size: 15px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin-top: 5px;
}

/* Autofill fix */
.hex-edit-form input:-webkit-autofill,
.hex-edit-form input:-webkit-autofill:hover,
.hex-edit-form input:-webkit-autofill:focus,
.hex-edit-form input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
    -webkit-text-fill-color: #fff !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Hover + focus */
.hex-edit-form input:focus,
.hex-edit-form select:focus {
    border: 1px solid #e0a84b;
    box-shadow: inset 0 0 10px rgba(224, 168, 75, 0.5), 0 0 10px rgba(224, 168, 75, 0.3);
    background: rgba(40, 30, 20, 0.7);
}

/* Кнопка */
#save-tile-btn {
    display: block;
    margin: 20px auto 0 auto;
    padding: 12px 25px;
    background: linear-gradient(to bottom, #3d2715, #2c1a10);
    color: #e0a84b;
    border: 1px solid #8b4513;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'MedievalSharp', cursive;
    font-size: 18px;
    text-shadow: 1px 1px 2px #000;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    width: 100%;
    box-sizing: border-box;
}

#save-tile-btn:hover {
    background: linear-gradient(to bottom, #9a5529, #6a4a31);
    color: #fff;
}

/* Для мобилок */
@media (max-width: 600px) {
    .hex-edit-form {
        padding: 20px;
        width: 95%;
    }
    .hex-edit-form h3 {
        font-size: 20px;
    }
    .hex-edit-form input,
    .hex-edit-form select {
        font-size: 14px;
    }
    #save-tile-btn {
        font-size: 16px;
        padding: 10px 15px;
    }
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(58,44,26,0.7), rgba(26,13,10,0.7));
    border: 1px solid #8b4513;
    border-radius: 24px;
    transition: 0.4s;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(to bottom, #f0e6d2, #e8c070);
    border-radius: 50%;
    transition: 0.4s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

input:checked + .slider {
    background: linear-gradient(to bottom, #4caf50, #3d8b45);
    border-color: #5a8c2e;
}

input:checked + .slider:before {
    transform: translateX(22px);
    background: linear-gradient(to bottom, #f0e6d2, #e8c070);
}

/* Hover эффект */
.switch:hover .slider {
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 0 5px rgba(224, 168, 75, 0.6);
}

/* Адаптация для мобильных */
@media (max-width: 600px) {
    .switch {
        width: 40px;
        height: 20px;
    }
    .slider:before {
        height: 16px;
        width: 16px;
        left: 2px;
        bottom: 2px;
    }
    input:checked + .slider:before {
        transform: translateX(20px);
    }
}











/* ----- ADMIN HEX ACTIONS ----- */

.hex-admin-actions {
    margin-top: 15px;
    padding-top: 8px;

    display: flex;
    justify-content: flex-end;
    gap: 6px;

    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.admin-action-item {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;

    font-size: 14px;

    border: 0;
    background: transparent;

    color: #e8c070;
    cursor: pointer;

    transition: all 0.15s ease;
}

/* hover */
.admin-action-item:hover {
    background: linear-gradient(
            to bottom,
            rgba(90, 57, 33, 0.9),
            rgba(58, 44, 26, 0.9)
    );

    border-color: #e0a84b;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

/* active click */
.admin-action-item:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}

/* mobile */
@media (max-width: 600px) {

    .admin-action-item {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

}


/* -------------------- Mailbox Modal CSS -------------------- */

.mailbox-modal .hex-content.mailbox-messages {
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
}

.modal-message {
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 6px;
}

.modal-message.system {
    background: rgba(80,50,30,0.3);
    border-left: 3px solid #e8c070;
}

.modal-message:not(.system) {
    background: rgba(58,44,26,0.3);
    border-left: 3px solid #8b4513;
}

.modal-message div:first-child {
    font-weight: bold;
    color: #e8c070;
}

.modal-message div:nth-child(2) {
    color: #f0e6d2;
    margin: 5px 0;
}

.modal-message div:nth-child(3) {
    font-size: 0.8em;
    color: #c0b080;
}

.messages-empty {
    color: #f0e6d2;
    text-align: center;
}

.modal-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.mailbox-input {
    flex-grow: 1;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #8b4513;
    background: rgba(26,13,10,0.7);
    color: #f0e6d2;
    font-family: 'MedievalSharp', cursive;
    outline: none;
}

.mailbox-send-btn {
    flex-shrink: 0;
}

/* Для мобильных */
@media (max-width: 600px) {
    .modal-footer {
        flex-direction: column;
    }
    .mailbox-input {
        width: 100%;
        margin-bottom: 5px;
    }
    .mailbox-send-btn {
        width: 100%;
    }
}
