/* ========== SMART MODAL OVERLAY ========== */
.smart-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(5, 3, 1, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.smart-modal-overlay[style*="display: flex"],
.smart-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ========== MODAL BOX WITH DECORATIONS ========== */
.smart-modal-box {
    position: relative;
    width: 100%;
    max-width: 600px;
    background: rgba(37, 33, 26, 0.95);
    border: 0.2vh solid rgba(104, 91, 68, 0.65);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.95), 
                0 10px 40px rgba(0, 0, 0, 0.8),
                0 0 20px rgba(0, 0, 0, 0.6);
    animation: modal-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 6vh;
    border-radius: 0;
    z-index: 100000;
    opacity: 0;
    transform: scale(0.92) translateY(-30px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.smart-modal-box.active {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* ========== MODAL DECORATIONS (Like page_decoration) ========== */
.page_decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.page_decoration img {
    width: 12vh;
    height: auto;
    position: absolute;
    opacity: 0.7;
}

/* Top-left corner */
.page_decoration img:nth-child(1) {
    left: 0;
    top: 0;
}

/* Top-right corner */
.page_decoration img:nth-child(2) {
    right: 0;
    bottom: 0;
    transform: rotate(180deg);
}

/* Bottom-right corner */
.page_decoration img:nth-child(3) {
    right: -0.75vh;
    top: 0.75vh;
    transform: rotate(90deg);
}

/* Bottom-left corner */
.page_decoration img:nth-child(4) {
    left: -0.8vh;
    bottom: 0.75vh;
    transform: rotate(-90deg);
}

/* ========== MODAL HEADER ========== */
.smart-modal-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 2vh;
    border-bottom: 0.2vh solid rgba(104, 91, 68, 0.4);
    margin-bottom: 3vh;
}

#smart-modal-title {
    font-size: 1.8vh;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(210, 175, 90, 0.95);
}

.smart-modal-close {
    background: none;
    border: none;
    color: rgba(180, 140, 60, 0.6);
    font-size: 2.4vh;
    cursor: pointer;
    padding: 0;
    width: 3.5vh;
    height: 3.5vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
    line-height: 1;
}

.smart-modal-close:hover {
    color: rgba(210, 175, 90, 0.9);
}

/* ========== MODAL BODY ========== */
.smart-modal-body {
    position: relative;
    z-index: 2;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 1vh;
}

/* Scrollbar styling */
.smart-modal-body::-webkit-scrollbar {
    width: 0.6vh;
}

.smart-modal-body::-webkit-scrollbar-track {
    background: rgba(104, 91, 68, 0.1);
    border-radius: 1vh;
}

.smart-modal-body::-webkit-scrollbar-thumb {
    background: rgba(210, 175, 90, 0.4);
    border-radius: 1vh;
}

.smart-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(210, 175, 90, 0.6);
}

/* ========== LOADING STATE ========== */
.smart-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
    padding: 4vh 2vh;
    text-align: center;
}

.smart-modal-spinner {
    width: 4vh;
    height: 4vh;
    border: 0.3vh solid rgba(210, 165, 60, 0.2);
    border-top-color: rgba(210, 165, 60, 0.9);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.smart-modal-loading span {
    font-size: 1.4vh;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.5px;
}

/* ========== MESSAGE CONTENT ========== */
.smart-modal-message {
    font-size: 2.4vh;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.8);
    word-break: break-word;
    text-align: left;
}

/* ========== SUCCESS STATE ========== */
.smart-modal-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
    padding: 2vh 0;
    text-align: center;
}

.smart-modal-success .smart-modal-icon {
    width: 5vh;
    height: 5vh;
    background: rgba(76, 175, 80, 0.2);
    border: 0.2vh solid rgba(76, 175, 80, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5vh;
    color: #66bb6a;
    font-weight: bold;
}

/* ========== ERROR STATE ========== */
.smart-modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
    padding: 2vh 0;
    text-align: center;
}

.smart-modal-error .smart-modal-icon {
    width: 5vh;
    height: 5vh;
    background: rgba(244, 67, 54, 0.2);
    border: 0.2vh solid rgba(244, 67, 54, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5vh;
    color: #ef5350;
    font-weight: bold;
}

/* ========== BUTTONS ========== */
.smart-modal-buttons {
    display: flex;
    gap: 1.5vh;
    margin-top: 3vh;
    padding-top: 2vh;
    border-top: 0.2vh solid rgba(104, 91, 68, 0.4);
    justify-content: flex-end;
}

.smart-modal-btn {
    flex: 0 0 auto;
    padding: 1.2vh 2.5vh;
    font-size: 1.3vh;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 0.2vh solid rgba(104, 91, 68, 0.65);
    background: rgba(37, 33, 26, 0.95);
    color: rgba(210, 175, 90, 0.95);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0;
    min-width: 12vh;
}

.smart-modal-btn:hover {
    background: rgba(60, 53, 42, 0.95);
    border-color: rgba(210, 175, 90, 0.5);
    color: rgba(210, 175, 90, 1);
}

.smart-modal-btn:active {
    transform: scale(0.98);
    opacity: 0.8;
}

/* Confirm button styling */
.smart-modal-btn.btn-confirm {
  width: 12vh;
  height: 4.2vh;
  border-radius: 10vh;
  background: linear-gradient(rgb(98, 80, 35), rgb(135, 113, 58));
  display: inline-flex;
  align-items: center;
  position: relative;
  border: 0.3vh solid rgb(199, 183, 153);
  transition: 0.5s;
}
.smart-modal-btn.btn-confirm:hover {
  border: 0.3vh solid rgb(252, 244, 231);
  box-shadow: inset 0vh 0vh 2vh wheat;
}
.smart-modal-btn.btn-confirm span {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7vh;
  color: white;
  border-radius: 10vh;
  position: relative;
}
.smart-modal-btn.btn-confirm span i {
  z-index: 1;
  margin: 0 !important;
}
.smart-modal-btn.btn-confirm span::before {
  content: "";
  top: 0;
  width: 60%;
  height: 100%;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  position: absolute;
  background-color: rgba(217, 211, 166, 0.293);
}
.smart-modal-btn.btn-confirm .decoration {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
}
.smart-modal-btn.btn-confirm .decoration img {
  position: absolute;
  z-index: 0;
  width: 6.2vh;
}
.smart-modal-btn.btn-confirm .decoration img:nth-child(1) {
  left: -3.8vh;
}
.smart-modal-btn.btn-confirm .decoration img:nth-child(2) {
  right: -3.8vh;
}

/* Cancel button styling */
.smart-modal-btn.btn-cancel {
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.5);
    color: #ef5350;
}

.smart-modal-btn.btn-cancel:hover {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.7);
}

/* ========== BLOCK BODY SCROLL WHEN MODAL OPEN ========== */
body.modal-open {
    overflow: hidden !important;
    height: 100vh;
    width: 100vw;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 920px) {
    .smart-modal-box {
        max-width: 90%;
        padding: 5vh;
    }

    .smart-modal-body {
        max-height: 55vh;
    }

    #smart-modal-title {
        font-size: 1.6vh;
    }

    .smart-modal-message {
        font-size: 1.3vh;
    }

    .page_decoration img {
        width: 10vh;
    }
}

@media (max-width: 640px) {
    .smart-modal-box {
        max-width: calc(100% - 20px);
        padding: 4vh;
    }

    .smart-modal-body {
        max-height: 50vh;
    }

    .smart-modal-buttons {
        flex-direction: column;
    }

    .smart-modal-btn {
        width: 100%;
        min-width: unset;
    }

    .page_decoration img {
        width: 8vh;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(-30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modal-out {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.92) translateY(-30px);
    }
}

/* ========== ACCESSIBILITY ========== */
.smart-modal-btn:focus {
    outline: 1px solid rgba(210, 175, 90, 0.5);
    outline-offset: 2px;
}

.smart-modal-close:focus {
    outline: 1px solid rgba(210, 175, 90, 0.5);
    outline-offset: 2px;
}
