/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Main Container */
.home-container {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 40px 20px;
}

/* Logo Section */
.logo-section {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.tree-logo {
    max-width: 600px;
    width: 100%;
    height: auto;
    animation: fadeInDown 0.8s ease-out;
}

/* Search Section */
.search-section {
    width: 100%;
    max-width: 700px;
    display: flex;
    justify-content: center;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
    position: relative;
}

.search-bar {
    width: 100%;
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    padding: 8px 8px 8px 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.search-bar:focus-within {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.search-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    color: #6c757d;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 18px;
    color: #495057;
    background: transparent;
    padding: 12px 8px;
}

.search-input::placeholder {
    color: #adb5bd;
}

.voice-search-button {
    width: 44px;
    height: 44px;
    margin-right: 8px;
    border-radius: 50%;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.voice-search-button:hover:not(:disabled) {
    background: #e9ecef;
    color: #212529;
    transform: scale(1.05);
}

.voice-search-button:active:not(:disabled) {
    transform: scale(0.98);
}

.voice-search-button.is-listening {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
    animation: voiceListeningPulse 1.4s ease-in-out infinite;
}

.voice-search-button:disabled,
.voice-search-button.is-unsupported,
.voice-search-button.is-denied {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    animation: none;
}

.voice-btn-icon {
    width: 22px;
    height: 22px;
}

@keyframes voiceListeningPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.35);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(40, 167, 69, 0);
    }
}

.search-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.search-button:hover {
    background: linear-gradient(135deg, #218838, #1ea085);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.5);
}

.search-button:active {
    transform: scale(0.98);
}

.search-btn-icon {
    width: 24px;
    height: 24px;
}

/* Cards Section */
.cards-section {
    width: 100%;
    max-width: 1400px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-top: 20px;
    animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

.card-placeholder {
    background: white;
    border: 2px solid #f9d71c;
    border-radius: 15px;
    min-height: 140px;
    padding: 18px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Default card state - Category only */
.card-category {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    text-align: center;
}

.card-description-text {
    font-size: 11px;
    color: #6c757d;
    text-align: center;
    line-height: 1.4;
    max-width: 100%;
    padding: 0 4px;
    transition: opacity 0.3s ease;
}

/* Hide description when card has content (search results) */
.card-placeholder.has-content .card-description-text {
    display: none;
}

.card-placeholder:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(249, 215, 28, 0.3);
    border-color: #e0c116;
}

/* All cards with content are clickable */
.card-placeholder.has-content {
    cursor: pointer;
}

.card-placeholder.has-content:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(244, 196, 48, 0.25);
    border-color: #d4a430;
}

.card-placeholder.has-content:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 196, 48, 0.2);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .cards-section {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .home-container {
        gap: 30px;
        padding: 30px 15px;
    }

    .tree-logo {
        max-width: 400px;
    }

    .search-bar {
        padding: 6px 6px 6px 20px;
    }

    .search-input {
        font-size: 16px;
        padding: 10px 6px;
    }

    .voice-search-button {
        width: 40px;
        height: 40px;
        margin-right: 6px;
    }

    .voice-btn-icon {
        width: 20px;
        height: 20px;
    }

    .search-button {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .cards-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .card-placeholder {
        min-height: 120px;
        padding: 15px;
    }
    
    .card-category {
        font-size: 16px;
    }
    
    .card-description-text {
        font-size: 10px;
    }
    
    .card-value {
        font-size: 24px;
    }
    
    .card-description {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .tree-logo {
        max-width: 300px;
    }

    .search-input {
        font-size: 14px;
    }

    .cards-section {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .card-placeholder {
        min-height: 110px;
        padding: 12px;
    }
    
    .card-category {
        font-size: 14px;
    }
    
    .card-description-text {
        font-size: 9px;
        line-height: 1.3;
    }
    
    .card-value {
        font-size: 22px;
    }
    
    .card-description {
        font-size: 10px;
    }
}

/* Card Content Styles (ready for your logic) */
.card-placeholder.has-content {
    background: linear-gradient(135deg, #ffffff, #fffef8);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 8px;
    text-align: center;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: #f9d71c;
    margin: 6px 0;
    line-height: 1.2;
}

.card-description {
    font-size: 12px;
    color: #6c757d;
    text-align: center;
    margin-top: 4px;
}

.card-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

/* Store List Styles */
.stores-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.store-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(249, 215, 28, 0.1);
    border-radius: 10px;
    border-left: 3px solid #f9d71c;
    transition: all 0.2s ease;
}

.store-item:hover {
    background: rgba(249, 215, 28, 0.15);
    transform: translateX(3px);
}

.store-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f9d71c, #e0c116);
    color: #212529;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(249, 215, 28, 0.3);
}

.store-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.store-name {
    font-size: 16px;
    font-weight: 600;
    color: #212529;
}

.store-count {
    font-size: 12px;
    color: #6c757d;
}

/* Responsive adjustments for store list */
@media (max-width: 768px) {
    .store-item {
        padding: 8px;
        gap: 10px;
    }
    
    .store-rank {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .store-name {
        font-size: 14px;
    }
    
    .store-count {
        font-size: 11px;
    }
}

/* Toast Notification Styles */
.toast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 500px;
    width: 90%;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.toast-content {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-left: 4px solid #6c757d;
    position: relative;
}

.toast-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.toast-content.toast-success {
    border-left-color: #28a745;
    background: linear-gradient(135deg, #ffffff, #f0fff4);
}

.toast-content.toast-error {
    border-left-color: #dc3545;
    background: linear-gradient(135deg, #ffffff, #fff5f5);
}

.toast-content.toast-info {
    border-left-color: #17a2b8;
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
}

.toast-icon {
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.toast-content.toast-success .toast-icon {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.toast-content.toast-error .toast-icon {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.toast-content.toast-info .toast-icon {
    background: rgba(23, 162, 184, 0.1);
    color: #17a2b8;
}

.toast-message {
    font-size: 16px;
    font-weight: 500;
    color: #212529;
    line-height: 1.5;
    flex: 1;
}

.toast-details {
    margin-top: 8px;
    font-size: 14px;
    color: #6c757d;
    line-height: 1.6;
    padding-top: 8px;
    border-top: 1px solid rgba(108, 117, 125, 0.2);
}

.toast-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
}

.toast-close:hover {
    background: rgba(108, 117, 125, 0.1);
    color: #212529;
    transform: scale(1.1);
}

/* Responsive adjustments for toast */
@media (max-width: 768px) {
    .toast-notification {
        top: 10px;
        width: 95%;
        max-width: none;
    }
    
    .toast-content {
        padding: 14px 16px;
    }
    
    .toast-message {
        font-size: 15px;
    }
    
    .toast-details {
        font-size: 13px;
    }
}

/* Guinea Pig Success Popup */
.guinea-pig-popup {
    position: absolute;
    left: calc(100% + 15px); /* Position to the right of search bar */
    top: 50%;
    transform: translateY(-50%) scale(0);
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

.guinea-pig-popup.show {
    opacity: 1;
    transform: translateY(-50%) scale(1);
    pointer-events: auto;
}

.guinea-pig-popup.bounce {
    animation: guineaPigBounce 0.6s ease-out;
}

@keyframes guineaPigBounce {
    0% {
        transform: translateY(-50%) scale(0);
    }
    50% {
        transform: translateY(-60%) scale(1.2);
    }
    70% {
        transform: translateY(-45%) scale(0.95);
    }
    100% {
        transform: translateY(-50%) scale(1);
    }
}

.guinea-pig-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.guinea-pig-emoji {
    font-size: 48px;
    line-height: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    animation: guineaPigWiggle 0.5s ease-in-out 0.3s;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.guinea-pig-emoji:hover {
    transform: scale(1.1) rotate(5deg);
}

@keyframes guineaPigWiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-8deg);
    }
    75% {
        transform: rotate(8deg);
    }
}

.guinea-pig-speech {
    position: relative;
}

.speech-bubble {
    background: linear-gradient(135deg, #f9d71c, #ffd700);
    color: #212529;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(249, 215, 28, 0.4);
    position: relative;
    white-space: nowrap;
    animation: speechPop 0.4s ease-out 0.2s backwards;
}

@keyframes speechPop {
    0% {
        opacity: 0;
        transform: scale(0) translateY(10px);
    }
    50% {
        transform: scale(1.1) translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffd700;
}

.speech-text {
    display: block;
}

/* Responsive adjustments for guinea pig */
@media (max-width: 768px) {
    .guinea-pig-popup {
        left: calc(100% + 10px);
    }
    
    .guinea-pig-emoji {
        font-size: 40px;
    }
    
    .speech-bubble {
        font-size: 12px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .guinea-pig-popup {
        left: calc(100% + 8px);
    }
    
    .guinea-pig-emoji {
        font-size: 36px;
    }
    
    .speech-bubble {
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* ============================================
   Items Modal Styles
   ============================================ */

.items-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.items-modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    border: 2px solid #F4C430;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    z-index: 1001;
    animation: slideUp 0.4s ease-out;
    overflow: hidden;
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.modal-icon {
    font-size: 24px;
}

.modal-count {
    color: #F4C430;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    border-radius: 6px;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

/* Modal Search */
.modal-search-container {
    padding: 16px 24px;
    border-bottom: 1px solid #e9ecef;
    background: #fafafa;
}

.modal-search-box {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    gap: 10px;
}

.modal-search-box:focus-within {
    border-color: #F4C430;
    box-shadow: 0 0 0 3px rgba(244, 196, 48, 0.1);
}

.search-icon-small {
    width: 18px;
    height: 18px;
    color: #6c757d;
    flex-shrink: 0;
}

.modal-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #333;
    background: transparent;
}

.modal-search-input::placeholder {
    color: #999;
    font-style: italic;
}

.modal-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.modal-search-clear:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-search-clear svg {
    width: 16px;
    height: 16px;
}

/* Modal Body */
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    min-height: 200px;
    max-height: calc(85vh - 200px);
}

.modal-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-left: 3px solid #F4C430;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
    cursor: default;
}

.modal-item:hover {
    background: #FFFDF0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateX(2px);
}

.modal-item:nth-child(even) {
    background: #fafafa;
}

.modal-item:nth-child(even):hover {
    background: #FFFDF0;
}

.item-upc {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    font-family: 'Courier New', monospace;
    margin-bottom: 6px;
}

.item-name {
    font-size: 16px;
    color: #555;
    margin-bottom: 4px;
    line-height: 1.4;
}

.item-country {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* Transactions Table Styles */
.modal-transactions-table {
    width: 100%;
    overflow-x: auto;
}

.transactions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.transactions-table thead {
    background: #F4C430;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

.transactions-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e0c116;
}

.transactions-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
}

.transactions-table tbody tr {
    transition: background-color 0.2s ease;
}

.transactions-table tbody tr:hover {
    background-color: #FFFDF0;
}

.transactions-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.transactions-table tbody tr:nth-child(even):hover {
    background-color: #FFFDF0;
}

/* Empty State */
.modal-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-message {
    font-size: 16px;
    color: #666;
}

/* Loading State */
.modal-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #F4C430;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    font-size: 14px;
    color: #666;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Footer */
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e9ecef;
    background: #fafafa;
    text-align: center;
}

.modal-footer-text {
    font-size: 14px;
    color: #666;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive - Mobile (Bottom Sheet Style) */
@media (max-width: 768px) {
    .items-modal {
        align-items: flex-end;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        border-left: none;
        border-right: none;
        border-top: 2px solid #F4C430;
        animation: slideUpMobile 0.4s ease-out;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 12px 16px;
        max-height: calc(85vh - 180px);
    }
    
    .modal-item {
        padding: 14px;
    }
    
    .item-upc {
        font-size: 13px;
    }
    
    .item-name {
        font-size: 15px;
    }
    
    .item-country {
        font-size: 11px;
    }
    
    .modal-search-container {
        padding: 12px 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
    }
}

@keyframes slideUpMobile {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Scrollbar Styling */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #F4C430;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #d4a430;
}

