/* Custom styles for Naver Band Shopping Mall */

/* Root Variables for Korean-friendly design */
:root {
    --font-family-korean: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard Variable', Pretendard, Roboto, 'Noto Sans KR', 'Segoe UI', 'Malgun Gothic', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
    --border-radius-lg: 1rem;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Body and Typography */
body {
    font-family: var(--font-family-korean);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Korean text optimization */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-korean);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Product Cards */
.product-card {
    transition: var(--transition-smooth);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1) !important;
}

.card-img-top-wrapper {
    position: relative;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.product-image {
    transition: var(--transition-smooth);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Product Overlay */
.product-overlay {
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: var(--transition-smooth);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.product-actions {
    transform: translateY(20px);
    transition: var(--transition-smooth);
}

.product-card:hover .product-actions {
    transform: translateY(0);
}

/* Navigation */
.navbar-brand {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.nav-link {
    font-weight: 500;
    padding: 0.75rem 1rem !important;
    transition: var(--transition-smooth);
}

.nav-link:hover {
    transform: translateY(-1px);
}

/* Cart Items */
.cart-item {
    transition: var(--transition-smooth);
}

.cart-item:hover {
    background-color: var(--bs-gray-100);
}

/* Quantity Controls */
.quantity-controls .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.quantity-controls .btn:hover {
    transform: scale(1.1);
}

/* Buttons */
.btn {
    font-weight: 600;
    letter-spacing: -0.01em;
    border-radius: 0.5rem;
    transition: var(--transition-smooth);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* Cards */
.card {
    border-radius: var(--border-radius-lg);
    transition: var(--transition-smooth);
}

.card-header {
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    font-weight: 600;
}

/* Modal */
.modal-content {
    border-radius: var(--border-radius-lg);
    border: none;
}

.modal-header {
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

/* Badge */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
}

/* Carousel */
.carousel-inner {
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Alert */
.alert {
    border-radius: 0.75rem;
    border: none;
    font-weight: 500;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Text Direction Fix for Mobile */
* {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.card-title, 
.product-title,
h1, h2, h3, h4, h5, h6,
.navbar-brand,
.nav-link,
.btn,
p, span, div {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    direction: ltr !important;
    unicode-bidi: normal !important;
    word-break: keep-all;
    white-space: normal;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-overlay {
        opacity: 1;
        background: rgba(0, 0, 0, 0.5);
    }
    
    .product-actions {
        transform: translateY(0);
    }
    
    .cart-item .col-md-4 {
        margin-bottom: 1rem;
    }
    
    .quantity-controls {
        margin: 1rem 0;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    /* Mobile text fix */
    .card-title {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
        word-break: keep-all !important;
        white-space: normal !important;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-lg {
        padding: 0.65rem 1.25rem;
        font-size: 1rem;
    }
}

/* Loading Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeIn 0.6s ease-out;
}

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }
.product-card:nth-child(5) { animation-delay: 0.5s; }
.product-card:nth-child(6) { animation-delay: 0.6s; }

/* Price Styling */
.text-primary {
    font-weight: 700;
}

/* Sticky cart summary */
.sticky-top {
    top: 2rem;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-gray-200);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--bs-gray-400);
    border-radius: 4px;
    transition: var(--transition-smooth);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-gray-500);
}

/* Focus styles for accessibility */
.btn:focus,
.nav-link:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: none;
}

/* KakaoTalk Button */
.btn-kakao {
    background: linear-gradient(135deg, #FEE500 0%, #FFEB3B 100%);
    color: #3C1E1E;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-kakao:hover {
    background: linear-gradient(135deg, #FFEB3B 0%, #FDD835 100%);
    color: #2E1515;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(254, 229, 0, 0.4);
}

.btn-kakao:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(254, 229, 0, 0.3);
}

.btn-kakao::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;
}

.btn-kakao:hover::before {
    left: 100%;
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .product-overlay,
    footer {
        display: none !important;
    }
    
    .product-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* Spin animation for loading states */
.spin {
    animation: spin 1s linear infinite;
}

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