@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Source+Sans+Pro:wght@300;400;600;700&family=JetBrains+Mono:wght@400;700;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Source Sans Pro', sans-serif;
    background: linear-gradient(135deg, #8B7355 0%, #5D4E37 100%);
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(139, 115, 85, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(93, 78, 55, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(101, 67, 33, 0.2) 0%, transparent 50%);
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(135deg, rgba(115, 123, 85, 0.95), rgba(85, 95, 67, 0.9));
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1),
        inset 0 -1px 0 rgba(0,0,0,0.2);
    border: 3px solid #5D6B32;
    animation: slideIn 0.8s ease-out;
    position: relative;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
    border-radius: 12px;
    pointer-events: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    text-align: center;
    font-family: 'Playfair Display', serif;
    color: #3A2A1A;
    margin-bottom: 30px;
    font-weight: 700;
    text-shadow: 
        2px 2px 4px rgba(212, 175, 55, 0.3),
        0 0 10px rgba(255, 215, 0, 0.6),
        0 0 20px rgba(255, 215, 0, 0.4),
        0 0 30px rgba(255, 215, 0, 0.3);
    letter-spacing: 1px;
    position: relative;
    z-index: 2;
}

.title-main {
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.1;
    margin-bottom: 5px;
}

.title-sub {
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    line-height: 1.1;
    font-weight: 600;
    opacity: 0.9;
}

h1::before {
    content: '⚔️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    opacity: 0.3;
    z-index: -1;
    filter: sepia(0.5) saturate(0.8) hue-rotate(30deg);
}

.total-section {
    text-align: center;
    margin-bottom: 40px;
    padding: 25px;
    background: linear-gradient(135deg, #654321, #8B4513);
    border-radius: 10px;
    box-shadow: 
        0 10px 25px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.1);
    border: 2px solid #D4AF37;
    transform: translateY(0);
    transition: all 0.3s ease;
    animation: pulse 2s ease-in-out infinite alternate;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-section::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #D4AF37, transparent, #D4AF37);
    border-radius: 12px;
    z-index: -1;
}

@keyframes pulse {
    from {
        box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
    }
    to {
        box-shadow: 0 10px 25px rgba(102, 126, 234, 0.6);
    }
}

.total-section h2 {
    color: #F5DEB3;
    margin-bottom: 0;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    flex: 1;
}

#totalCost {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    color: #FFD700;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.7);
    font-family: 'JetBrains Mono', monospace;
}

.clear-btn {
    background: linear-gradient(45deg, #8B0000, #A0522D);
    color: #F5DEB3;
    border: 2px solid #D4AF37;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Source Sans Pro', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 
        0 5px 15px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.1);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    flex-shrink: 0;
    margin-left: 20px;
}

.clear-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    background: linear-gradient(45deg, #A0522D, #8B0000);
    border-color: #FFD700;
}

.clear-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.unit-card {
    background: linear-gradient(135deg, rgba(115, 123, 85, 0.9), rgba(85, 95, 67, 0.8));
    backdrop-filter: blur(10px);
    border: 2px solid #5D6B32;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    animation: cardFloat 3s ease-in-out infinite;
    box-shadow: 
        0 8px 20px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.unit-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(212, 175, 55, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
    opacity: 0;
}

.unit-card:hover::before {
    animation: shimmer 0.8s ease;
    opacity: 1;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

@keyframes cardFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

.unit-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.4),
        0 0 20px rgba(212, 175, 55, 0.3);
    border: 2px solid #D4AF37;
}

.unit-card:nth-child(odd) {
    animation-delay: -1s;
}

.unit-card:nth-child(even) {
    animation-delay: -2s;
}

.unit-image {
    height: 60px;
    max-width: 150px;
    width: auto;
    object-fit: contain;
    margin: 0 auto 15px auto;
    border-radius: 8px;
    border: 2px solid #654321;
    transition: all 0.3s ease;
    filter: sepia(0.3) contrast(1.1) drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    display: block;
}

.unit-image:hover {
    transform: scale(1.1);
    filter: sepia(0.1) contrast(1.2) drop-shadow(0 4px 8px rgba(0,0,0,0.4));
    border-color: #D4AF37;
}

.unit-header {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 20px;
    position: relative;
}

.unit-card h3 {
    font-family: 'Playfair Display', serif;
    color: #3A2A1A;
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(212, 175, 55, 0.3);
    background: rgba(245, 222, 179, 0.8);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    text-align: center;
    width: 100%;
}

.price-tag {
    background: linear-gradient(135deg, #2E7D32, #4CAF50);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    transform: rotate(-5deg) translateY(-15px);
    box-shadow: 
        0 4px 15px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.2);
    position: absolute;
    right: -10px;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    z-index: 10;
}

.price-number {
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1;
    font-family: 'JetBrains Mono', monospace;
}

.price-currency {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

.counter {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.increment, .decrement {
    background: linear-gradient(135deg, #654321, #8B4513);
    color: #F5DEB3;
    border: 2px solid #D4AF37;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 24px;
    font-weight: 700;
    font-family: 'Source Sans Pro', sans-serif;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 
        0 5px 15px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
    position: relative;
    overflow: hidden;
}

.increment::before, .decrement::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.increment:hover::before, .decrement:hover::before {
    width: 100%;
    height: 100%;
}

.increment:hover, .decrement:hover {
    transform: scale(1.1) rotate(3deg);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    border-color: #FFD700;
}

.increment:active, .decrement:active {
    transform: scale(0.95);
    animation: buttonPulse 0.2s ease;
}

@keyframes buttonPulse {
    0%, 100% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
}

.decrement {
    background: linear-gradient(135deg, #8B0000, #A0522D);
    border-color: #D4AF37;
}

.decrement:hover {
    transform: scale(1.1) rotate(-3deg);
}

.count {
    font-size: 32px;
    font-weight: 700;
    min-width: 60px;
    font-family: 'JetBrains Mono', monospace;
    color: #3A2A1A;
    background: rgba(245, 222, 179, 0.9);
    padding: 8px 12px;
    border-radius: 12px;
    border: 2px solid #D4AF37;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.count.updated {
    animation: countUpdate 0.5s ease;
}

@keyframes countUpdate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.subtotal {
    font-weight: 600;
    font-size: 1rem;
    padding: 6px 8px;
    border-radius: 6px;
    background: linear-gradient(135deg, #654321, #8B4513);
    color: #F5DEB3;
    border: 2px solid #D4AF37;
    box-shadow: 
        0 2px 8px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    font-family: 'Source Sans Pro', sans-serif;
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
    body {
        padding: 3px;
    }
    
    .container {
        padding: 12px;
        margin: 2px;
        border-radius: 8px;
    }
    
    h1 {
        margin-bottom: 15px;
    }
    
    .title-main {
        font-size: clamp(1.4rem, 5vw, 2.2rem);
        margin-bottom: 2px;
    }
    
    .title-sub {
        font-size: clamp(1rem, 3vw, 1.6rem);
    }
    
    .total-section {
        position: sticky;
        top: 5px;
        z-index: 100;
        margin-bottom: 12px;
        padding: 12px;
        background: linear-gradient(135deg, #654321, #8B4513);
        box-shadow: 
            0 8px 20px rgba(0,0,0,0.6),
            inset 0 1px 0 rgba(255,255,255,0.1);
        flex-direction: row;
        gap: 10px;
    }
    
    .total-section h2 {
        font-size: clamp(1.2rem, 4vw, 1.8rem);
        margin-bottom: 0;
    }
    
    #totalCost {
        font-size: clamp(2rem, 8vw, 3rem);
    }
    
    .clear-btn {
        padding: 8px 16px;
        font-size: 12px;
        margin-left: 0;
    }
    
    .units-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .unit-card {
        padding: 12px;
    }
    
    .unit-image {
        height: 50px;
        max-width: 200px;
        margin: 0 auto 6px auto;
    }
    
    .unit-header {
        margin-bottom: 12px;
    }
    
    .unit-card h3 {
        font-size: 1rem;
        padding: 4px 8px;
    }
    
    .price-tag {
        padding: 6px 10px;
        min-width: 40px;
        right: -8px;
        transform: rotate(-5deg) translateY(-12px);
    }
    
    .price-number {
        font-size: 1.4rem;
    }
    
    .price-currency {
        font-size: 0.6rem;
    }
    
    .subtotal {
        font-size: 0.8rem;
        padding: 4px 6px;
    }
}

@media (max-width: 480px) {
    .units-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .unit-card {
        padding: 10px;
    }
    
    .unit-image {
        height: 45px;
        max-width: 200px;
        margin: 0 auto 4px auto;
    }
    
    .unit-header {
        margin-bottom: 10px;
    }
    
    .unit-card h3 {
        font-size: 0.9rem;
        padding: 3px 6px;
    }
    
    .price-tag {
        padding: 5px 8px;
        min-width: 35px;
        right: -6px;
        transform: rotate(-5deg) translateY(-10px);
    }
    
    .price-number {
        font-size: 1.2rem;
    }
    
    .price-currency {
        font-size: 0.5rem;
    }
    
    .subtotal {
        font-size: 0.7rem;
        padding: 3px 5px;
    }
    
    .total-section {
        top: 2px;
        padding: 10px;
        margin-bottom: 10px;
        flex-direction: row;
        gap: 8px;
    }
    
    .total-section h2 {
        font-size: clamp(1rem, 4vw, 1.6rem);
        margin-bottom: 0;
    }
    
    #totalCost {
        font-size: clamp(1.8rem, 10vw, 2.5rem);
    }
    
    .clear-btn {
        padding: 6px 12px;
        font-size: 11px;
        margin-left: 0;
    }
}

/* Loading animation for page */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.unit-card {
    animation: fadeInUp 0.6s ease forwards;
}

.unit-card:nth-child(1) { animation-delay: 0.1s; }
.unit-card:nth-child(2) { animation-delay: 0.2s; }
.unit-card:nth-child(3) { animation-delay: 0.3s; }
.unit-card:nth-child(4) { animation-delay: 0.4s; }
.unit-card:nth-child(5) { animation-delay: 0.5s; }
.unit-card:nth-child(6) { animation-delay: 0.6s; }
.unit-card:nth-child(7) { animation-delay: 0.7s; }
.unit-card:nth-child(8) { animation-delay: 0.8s; }

.unit-card {
    animation: fadeInUp 0.6s ease forwards;
}

.unit-card:nth-child(1) { animation-delay: 0.1s; }
.unit-card:nth-child(2) { animation-delay: 0.2s; }
.unit-card:nth-child(3) { animation-delay: 0.3s; }
.unit-card:nth-child(4) { animation-delay: 0.4s; }
.unit-card:nth-child(5) { animation-delay: 0.5s; }
.unit-card:nth-child(6) { animation-delay: 0.6s; }
.unit-card:nth-child(7) { animation-delay: 0.7s; }
.unit-card:nth-child(8) { animation-delay: 0.8s; }
