/* ================================
   CSS PART 2: DIALOGS & MODALS
   (was the bottom part of styles.css)
   Starts at "/* Custom Confirmation Dialog *\/"
   through to the very end of the original file.
*/

/* Custom Confirmation Dialog */
.confirmation-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.confirmation-dialog-content {
    background: linear-gradient(135deg, var(--brown-deep), var(--rust-red));
    border: 4px solid var(--gold);
    box-shadow: 
        0 0 30px rgba(218, 165, 32, 0.6),
        inset 0 0 20px rgba(139, 69, 19, 0.3);
    padding: 20px;
    width: 100%;
    max-width: 450px;
    position: relative;
}

.confirmation-dialog-content::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        var(--gold), var(--copper), var(--gold), var(--copper), var(--gold));
    background-size: 10px 10px;
    animation: borderShimmer 2s linear infinite;
    z-index: -1;
}

.confirmation-dialog-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gold);
}

.confirmation-dialog-header h3 {
    color: var(--gold);
    font-size: 1.3rem;
    font-weight: bold;
    letter-spacing: 2px;
    margin: 0;
    text-shadow: 
        2px 2px 0px var(--black),
        4px 4px 10px rgba(0, 0, 0, 0.8);
}

.confirmation-dialog-body {
    margin-bottom: 25px;
    text-align: center;
}

.confirmation-dialog-body p {
    color: var(--sand-light);
    font-size: 1rem;
    margin-bottom: 15px;
    text-shadow: 1px 1px 0px var(--black);
    line-height: 1.4;
}

.confirmation-dialog-cost {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--sand-medium);
}

.confirmation-dialog-cost span:first-child {
    color: var(--sand-medium);
}

.cost-value {
    color: var(--gold);
    text-shadow: 1px 1px 0px var(--black);
}

.confirmation-dialog-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirmation-btn {
    padding: 12px 25px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    border: 3px solid;
    background: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.2s ease;
    min-width: 100px;
    min-height: 50px;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.confirmation-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.confirmation-btn:hover::before,
.confirmation-btn:active::before {
    left: 100%;
}

.confirmation-btn-yes {
    color: var(--cobalt-blue);
    border-color: var(--cobalt-blue);
    box-shadow: 
        4px 4px 0px var(--gray-dark),
        0 0 15px rgba(46, 92, 138, 0.3);
}

.confirmation-btn-yes:hover,
.confirmation-btn-yes:active {
    background: linear-gradient(135deg, var(--cobalt-blue), #4A7BA7);
    color: var(--white);
    transform: translate(2px, 2px);
    box-shadow: 
        2px 2px 0px var(--gray-dark),
        0 0 20px rgba(46, 92, 138, 0.6);
}

.confirmation-btn-no {
    color: var(--rust-red);
    border-color: var(--rust-red);
    box-shadow: 
        4px 4px 0px var(--gray-dark),
        0 0 15px rgba(139, 69, 19, 0.3);
}

.confirmation-btn-no:hover,
.confirmation-btn-no:active {
    background: linear-gradient(135deg, var(--rust-red), #A0522D);
    color: var(--white);
    transform: translate(2px, 2px);
    box-shadow: 
        2px 2px 0px var(--gray-dark),
        0 0 20px rgba(139, 69, 19, 0.6);
}

/* Warrior Box Modal */
.warrior-box-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    padding: 20px;
}

.warrior-box-modal-content {
    background: linear-gradient(135deg, var(--brown-deep), var(--rust-red));
    border: 4px solid var(--gold);
    box-shadow: 
        0 0 30px rgba(218, 165, 32, 0.6),
        inset 0 0 20px rgba(139, 69, 19, 0.3);
    padding: 20px;
    width: 100%;
    max-width: 600px;
    position: relative;
}

.warrior-box-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gold);
}

.warrior-box-modal-header h3 {
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 2px;
    margin: 0;
    text-shadow: 
        2px 2px 0px var(--black),
        4px 4px 10px rgba(0, 0, 0, 0.8);
}

.close-warrior-box-btn {
    background: var(--rust-red);
    color: var(--sand-light);
    border: 2px solid var(--black);
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
    touch-action: manipulation;
}

.close-warrior-box-btn:hover,
.close-warrior-box-btn:active {
    background: var(--brown-deep);
    transform: scale(1.05);
}

.warrior-box-selection {
    text-align: center;
}

.warrior-box-image {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.warrior-box-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.warrior-box-controls label {
    color: var(--sand-light);
    font-weight: bold;
    font-size: 1.1rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    background: var(--cobalt-blue);
    color: var(--sand-light);
    border: 2px solid var(--black);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
    touch-action: manipulation;
}

.quantity-btn:hover,
.quantity-btn:active {
    background: #4A7BA7;
    transform: scale(1.05);
}

#warriorBoxQuantity {
    width: 80px;
    height: 40px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    background: var(--sand-light);
    color: var(--black);
    border: 2px solid var(--black);
}

.total-cost {
    color: var(--gold);
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 1px 1px 0px var(--black);
}

.open-box-btn {
    padding: 15px 30px;
    background: var(--gold);
    color: var(--black);
    border: 3px solid var(--black);
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.2s ease;
    min-height: 50px;
    touch-action: manipulation;
    box-shadow: 4px 4px 0px var(--gray-dark);
}

.open-box-btn:hover,
.open-box-btn:active {
    background: var(--copper);
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px var(--gray-dark);
}

.box-opening-animation {
    text-align: center;
    padding: 40px;
}

.animated-box {
    width: 120px;
    height: 120px;
    animation: boxShake 0.5s ease-in-out infinite;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

@keyframes boxShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px) rotate(-2deg); }
    75% { transform: translateX(5px) rotate(2deg); }
}

.opening-text {
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 20px;
    text-shadow: 2px 2px 0px var(--black);
    animation: textPulse 1s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.warrior-reveal {
    text-align: center;
}

.warrior-reveal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.revealed-warrior-image {
    width: 100px;
    height: 100px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    animation: warriorAppear 1s ease-out;
}

@keyframes warriorAppear {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.warrior-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    overflow-x: hidden;
}

.warrior-stats h4 {
    color: var(--gold);
    font-size: 1.3rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 0px var(--black);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.stat-label {
    color: var(--sand-medium);
    font-weight: bold;
}

.stat-value {
    color: var(--sand-light);
    font-weight: bold;
}

.warrior-description {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--sand-medium);
}

.warrior-description p {
    color: var(--sand-light);
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

.close-warrior-reveal-btn {
    padding: 12px 25px;
    background: var(--cobalt-blue);
    color: var(--sand-light);
    border: 2px solid var(--black);
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.1s ease;
    touch-action: manipulation;
}

.close-warrior-reveal-btn:hover,
.close-warrior-reveal-btn:active {
    background: #4A7BA7;
    transform: scale(1.05);
}

/* Resource Selling Modal */
.resource-selling-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    padding: 20px;
}

.resource-selling-modal-content {
    background: linear-gradient(135deg, var(--brown-deep), var(--rust-red));
    border: 4px solid var(--gold);
    box-shadow: 
        0 0 30px rgba(218, 165, 32, 0.6),
        inset 0 0 20px rgba(139, 69, 19, 0.3);
    padding: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.resource-selling-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gold);
}

.resource-selling-modal-header h3 {
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 2px;
    margin: 0;
    text-shadow: 
        2px 2px 0px var(--black),
        4px 4px 10px rgba(0, 0, 0, 0.8);
}

.close-resource-selling-btn {
    background: var(--rust-red);
    color: var(--sand-light);
    border: 2px solid var(--black);
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
    touch-action: manipulation;
}

.close-resource-selling-btn:hover,
.close-resource-selling-btn:active {
    background: var(--brown-deep);
    transform: scale(1.05);
}

.resource-selling-info {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--sand-medium);
}

.selling-resource-icon {
    font-size: 3rem;
    text-shadow: 2px 2px 0px var(--black);
}

.selling-resource-details {
    flex: 1;
}

.selling-resource-details p {
    color: var(--sand-light);
    font-size: 1.1rem;
    margin: 5px 0;
    font-weight: bold;
}

.quantity-selection {
    margin-bottom: 20px;
}

.quantity-selection label {
    display: block;
    color: var(--sand-light);
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    background: var(--cobalt-blue);
    color: var(--sand-light);
    border: 2px solid var(--black);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
    touch-action: manipulation;
}

.quantity-btn:hover,
.quantity-btn:active {
    background: #4A7BA7;
    transform: scale(1.05);
}

#sellQuantity {
    width: 80px;
    height: 40px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    background: var(--sand-light);
    color: var(--black);
    border: 2px solid var(--black);
}

.selling-total {
    margin-bottom: 20px;
    text-align: center;
    padding: 15px;
    background: rgba(218, 165, 32, 0.2);
    border: 2px solid var(--gold);
}

.selling-total p {
    color: var(--gold);
    font-size: 1.3rem;
    font-weight: bold;
    margin: 0;
    text-shadow: 2px 2px 0px var(--black);
}

.selling-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.sell-btn,
.cancel-sell-btn {
    padding: 12px 25px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    border: 3px solid;
    background: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.2s ease;
    min-width: 100px;
    min-height: 50px;
    touch-action: manipulation;
}

.sell-btn {
    background: var(--cobalt-blue);
    color: var(--white);
    border-color: var(--cobalt-blue);
    box-shadow: 
        4px 4px 0px var(--gray-dark),
        0 0 15px rgba(46, 92, 138, 0.3);
}

.sell-btn:hover,
.sell-btn:active {
    background: linear-gradient(135deg, var(--cobalt-blue), #4A7BA7);
    color: var(--white);
    transform: translate(2px, 2px);
    box-shadow: 
        2px 2px 0px var(--gray-dark),
        0 0 20px rgba(46, 92, 138, 0.6);
}

.cancel-sell-btn {
    background: var(--rust-red);
    color: var(--white);
    border-color: var(--rust-red);
    box-shadow: 
        4px 4px 0px var(--gray-dark),
        0 0 15px rgba(139, 69, 19, 0.3);
}

.cancel-sell-btn:hover,
.cancel-sell-btn:active {
    background: linear-gradient(135deg, var(--rust-red), #A0522D);
    color: var(--white);
    transform: translate(2px, 2px);
    box-shadow: 
        2px 2px 0px var(--gray-dark),
        0 0 20px rgba(139, 69, 19, 0.6);
}

/* Add styles for resource stats */
.resource-stats-info {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--sand-medium);
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.resource-stats-info h4 {
    color: var(--gold);
    font-size: 1rem;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid var(--sand-medium);
    padding-bottom: 5px;
}

.resource-production .stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    color: var(--sand-light);
    font-size: 0.9rem;
}

.resource-production .stat-row.net-change {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--sand-medium);
    font-weight: bold;
}

.resource-production .positive {
    color: #4CAF50;
}

.resource-production .negative {
    color: #f44336;
}

.resource-production #resourceNetChange.positive {
    color: #4CAF50;
}

.resource-production #resourceNetChange.negative {
    color: #f44336;
}

/* Wife Notification Modal */
.wife-notification-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 4000;
    padding: 20px;
}
.wife-notification-modal.hidden {
    display: none;
}
.wife-notification-content {
    background: linear-gradient(135deg, var(--brown-deep), var(--rust-red));
    border: 4px solid var(--gold);
    box-shadow: 
        0 0 30px rgba(218,165,32,0.6),
        inset 0 0 20px rgba(139,69,19,0.3);
    padding: 20px;
    width: 100%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
}
.wife-notification-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 10px;
}
.close-wife-notification-btn {
    background: var(--rust-red);
    color: var(--sand-light);
    border: 2px solid var(--black);
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
    border-radius: 50%;
    touch-action: manipulation;
}
.close-wife-notification-btn:hover,
.close-wife-notification-btn:active {
    background: var(--brown-deep);
    transform: scale(1.05);
}
.wife-notification-body {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}
.notification-wife-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    object-fit: cover;
}
.notification-wife-name {
    color: var(--gold);
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 1px 1px 0 var(--black);
    margin-bottom: 5px;
}
.wife-notification-body p {
    color: var(--sand-light);
    font-size: 0.9rem;
    margin: 2px 0;
}
.wife-notification-message {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--sand-medium);
    border-radius: 4px;
    color: var(--sand-light);
    font-size: 1rem;
    text-align: center;
}
.wife-notification-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.marry-from-notification-btn,
.dismiss-notification-btn {
    padding: 12px 25px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    border: 3px solid;
    background: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.1s ease;
    min-width: 120px;
    min-height: 40px;
    touch-action: manipulation;
}
.marry-from-notification-btn {
    background: var(--cobalt-blue);
    color: var(--white);
    border-color: var(--cobalt-blue);
}
.marry-from-notification-btn:hover,
.marry-from-notification-btn:active {
    background: #4A7BA7;
    transform: translate(2px,2px);
}
.dismiss-notification-btn {
    background: var(--rust-red);
    color: var(--white);
    border-color: var(--rust-red);
}
.dismiss-notification-btn:hover,
.dismiss-notification-btn:active {
    background: #A0522D;
    transform: translate(2px,2px);
}

/* Mobile responsive for warrior box modal */
@media (max-width: 768px) {
    .warrior-box-modal-content {
        max-width: 95%;
        padding: 15px;
    }
    
    .warrior-box-image,
    .animated-box {
        width: 80px;
        height: 80px;
    }
    
    .revealed-warrior-image {
        width: 80px;
        height: 80px;
    }
    
    .warrior-stats {
        min-width: 250px;
        padding: 10px;
    }
    
    .warrior-box-modal-header h3 {
        font-size: 1.2rem;
    }
    
    .quantity-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    #warriorBoxQuantity {
        width: 60px;
        height: 35px;
        font-size: 1rem;
    }
    
    .quantity-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .selling-actions {
        flex-direction: column;
    }
}

/* Update the building panel styles for better description display */
.building-panel,
.unit-panel,
.warrior-action-panel,
.cannon-panel {
    position: absolute;
    top: 80px;
    right: 15px;
    width: 240px;
    background: var(--brown-deep);
    border: 3px solid var(--gold);
    padding: 12px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    box-sizing: border-box;
}

/* Update extended info styles */
.extended-info {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--sand-medium);
    font-size: 0.9rem;
    line-height: 1.4;
}

.extended-info .stat-row {
    margin-bottom: 12px;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
}

.extended-info .stat-label {
    color: var(--gold);
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 3px;
    width: 100%;
}

.extended-info .stat-value {
    color: var(--sand-light);
    font-size: 0.85rem;
    text-align: left;
    line-height: 1.4;
    width: 100%;
    white-space: normal;
    word-wrap: break-word;
}

/* Improve mobile responsiveness */
@media (max-width: 768px) {
    .building-panel,
    .unit-panel,
    .warrior-action-panel,
    .cannon-panel {
        position: fixed;
        top: auto;
        bottom: 60px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        max-height: 40vh;
        padding: 15px;
    }

    .extended-info {
        margin-top: 12px;
        padding-top: 8px;
    }

    .extended-info .stat-row {
        margin-bottom: 10px;
    }

    .extended-info .stat-label {
        font-size: 0.85rem;
    }

    .extended-info .stat-value {
        font-size: 0.8rem;
    }
}

/* Add custom scrollbar for panels */
.building-panel::-webkit-scrollbar,
.unit-panel::-webkit-scrollbar,
.warrior-action-panel::-webkit-scrollbar,
.cannon-panel::-webkit-scrollbar {
    width: 8px;
}

.building-panel::-webkit-scrollbar-track,
.unit-panel::-webkit-scrollbar-track,
.warrior-action-panel::-webkit-scrollbar-track,
.cannon-panel::-webkit-scrollbar-track {
    background: var(--brown-deep);
}

.building-panel::-webkit-scrollbar-thumb,
.unit-panel::-webkit-scrollbar-thumb,
.warrior-action-panel::-webkit-scrollbar-thumb,
.cannon-panel::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 4px;
}

.building-panel::-webkit-scrollbar-thumb:hover,
.unit-panel::-webkit-scrollbar-thumb:hover,
.warrior-action-panel::-webkit-scrollbar-thumb:hover,
.cannon-panel::-webkit-scrollbar-thumb:hover {
    background: var(--copper);
}