/* Profit & Loss Dashboard Styles */

/* ===== METRICS CARDS ===== */
.card-box {
    border-radius: 16px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    border: 1px solid #e8ecf0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.card-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    border-radius: 16px 16px 0 0;
}

.card-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #d1d9e6;
}

.card-box.active {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1), inset 0 -3px 0 #667eea;
    border-color: #667eea;
}

.card-box h6 {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-box h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 4px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: subtlePulse 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

.card-box:hover h3 {
    transform: scale(1.05);
    animation-play-state: paused;
}

@keyframes subtlePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.card-box h3 i {
    font-size: 16px;
    color: #9ca3af;
    margin: 0;
    float: none;
}

.small-text {
    font-size: 11px;
    color: #9ca3af;
    margin: 0;
    font-weight: 400;
}

.highlight {
    color: #1f2937;
    padding: 0;
    font-weight: 500;
}

.highlight.increase {
    color: #10b981;
}

.highlight.decrease {
    color: #ef4444;
}

.col-width-custom {
    margin-bottom: 20px;
    padding: 0 10px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* ===== PRODUCT CARDS ===== */
.custom-card {
    border: 1px solid #e8ecf0;
    border-radius: 16px;
    padding-left: 24px;
    padding-right: 24px;  
    padding-top: 24px;  
    padding-bottom: 15px;  
    margin: 15px 0;
    min-height: 580px !important;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    font-family: "Cerebri Sans", sans-serif;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    z-index: 1;
}

.custom-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    border-radius: 16px 16px 0 0;
}

.custom-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    border-color: #d1d9e6;
}

.custom-card img {
    max-height: 55px;
    margin-bottom: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    animation: fadeInScale 0.6s ease forwards;
}

.custom-card img:hover {
    transform: scale(1.05) rotate(1deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.custom-card h4 {
    margin-top: 15px;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
}

.asin_color {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    color: #5a6c7d;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 16px;
    display: inline-block;
    border: 1px solid rgba(102, 126, 234, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin: 3px 0;
    transition: all 0.2s ease;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asin_color:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.2);
    background: linear-gradient(135deg, #e1f5fe 0%, #f8bbd9 100%);
}

.asin_color:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s ease;
}

.product-info-container {
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.custom-card .metric {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
    animation: subtlePulse 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

.custom-card .metric:hover {
    transform: scale(1.05);
    animation-play-state: paused;
}

.custom-card .subtext {
    color: #6b7280;
    font-size: 13px;
    margin-top: -2px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-card .row {
    margin-top: 15px;
}

.custom-card .row div {
    margin-bottom: 10px;
}

.custom-card hr {
    margin: 10px 0;
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #e5e7eb 50%, transparent 100%);
    border-radius: 1px;
}

.details {
    line-height: 2.2;
    background: rgba(248, 250, 252, 0.5);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    margin-top: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.details:hover::before {
    left: 100%;
}

.details:hover {
    background: rgba(248, 250, 252, 0.8);
    border-color: rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
}

.details strong {
    color: #374151;
    font-weight: 600;
}

.details .float-right {
    color: #6b7280;
    font-weight: 500;
}

.float-right {
    float: right !important;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 60px;
}

.card-title img {
    max-height: 50px;
    width: auto;
}

.searchable-name {
    display: block;
    max-width: 100%;
    word-wrap: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.3;
}

/* ===== POPOVER STYLES ===== */
.custom-popover {
    color: #007bff !important;
    transition: all 0.2s ease-in-out;
}

.custom-popover:hover {
    color: #0056b3 !important;
    transform: scale(1.1);
}

.popover {
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    max-width: 450px !important;
    min-width: 400px !important;
    font-family: "Cerebri Sans", sans-serif !important;
    z-index: 9999 !important;
}

.popover .popover-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px 12px 0 0 !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    padding: 8px 12px !important;
    text-align: center !important;
    letter-spacing: 0.5px !important;
}

.popover .popover-content {
    padding: 0 !important;
    background: #ffffff !important;
    border-radius: 0 0 12px 12px !important;
}

.financial-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-weight: 400;
}

.financial-details-table tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.financial-details-table tr:hover {
    background-color: #f8f9fa;
}

.financial-details-table tr:last-child {
    border-bottom: none;
}

.financial-details-table td {
    padding: 6px 12px;
    vertical-align: middle;
}

.financial-details-table td:first-child {
    font-weight: 400;
    color: #374151;
    width: 65%;
    padding-right: 12px;
}

.financial-details-table td:last-child {
    text-align: right;
    font-weight: 500;
    width: 35%;
    padding-left: 8px;
}

.financial-details-table .positive-value {
    color: #28a745;
}

.financial-details-table .negative-value {
    color: #dc3545;
}

.financial-details-table .neutral-value {
    color: #6c757d;
}

.financial-details-table .key-metric {
    background: rgba(248, 250, 252, 0.6);
    font-weight: 500;
    color: #1f2937;
}

.financial-details-table .key-metric td:first-child {
    color: #1f2937;
    font-weight: 500;
}

.financial-details-table .key-metric td:last-child {
    font-weight: 600;
}

.financial-details-table .section-separator {
    background: #f3f4f6;
    height: 1px;
}

.financial-details-table .section-separator td {
    padding: 0;
    height: 1px;
}

.popover > .arrow {
    border-width: 8px !important;
}

.popover > .arrow:after {
    border-width: 7px !important;
}

.popover.left > .arrow {
    border-left-color: rgba(0, 0, 0, 0.1) !important;
}

.popover.left > .arrow:after {
    border-left-color: #ffffff !important;
}

/* ===== RESPONSIVE DESIGN ===== */
.col-sm-4 {
    overflow: visible !important;
}

.row {
    overflow: visible !important;
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .card-box {
        min-height: 100px;
        padding: 15px;
    }
    
    .card-box h3 {
        font-size: 20px;
    }
    
    .card-box h6 {
        font-size: 11px;
    }

    .custom-card {
        margin: 10px 0;
        padding: 20px;
        border-radius: 12px;
    }

    .custom-card .metric {
        font-size: 20px;
    }

    .custom-card h4 {
        font-size: 15px;
    }

    .asin_color {
        font-size: 11px;
        padding: 5px 10px;
    }

    .details {
        padding: 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .card-box {
        min-height: 90px;
        padding: 12px;
    }
    
    .card-box h3 {
        font-size: 18px;
    }
    
    .card-box h6 {
        font-size: 10px;
    }

    .custom-card {
        padding: 16px;
    }

    .custom-card .metric {
        font-size: 18px;
    }

    .product-info-container {
        gap: 4px;
    }
}

/* ===== LOADING ANIMATIONS ===== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 20px;
}

.modern-loader {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
}

.modern-loader::before,
.modern-loader::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.modern-loader::before {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation-delay: 0s;
}

.modern-loader::after {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    top: 10px;
    left: 10px;
    animation-delay: 0.5s;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
}

.loading-text {
    color: #667eea;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    margin-top: 10px;
    animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

.loading-dots {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
    margin: 20px 0;
}

.loading-dots div {
    position: absolute;
    top: 33px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading-dots div:nth-child(1) {
    left: 8px;
    animation: loading-dots1 0.6s infinite;
}

.loading-dots div:nth-child(2) {
    left: 8px;
    animation: loading-dots2 0.6s infinite;
}

.loading-dots div:nth-child(3) {
    left: 32px;
    animation: loading-dots2 0.6s infinite;
}

.loading-dots div:nth-child(4) {
    left: 56px;
    animation: loading-dots3 0.6s infinite;
}

@keyframes loading-dots1 {
    0% {
        transform: scale(0);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes loading-dots3 {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(0);
    }
}

@keyframes loading-dots2 {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(24px, 0);
    }
}

/* Skeleton Loading for Cards */
.skeleton-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 24px;
    margin: 15px 0;
    min-height: 580px;
    border: 1px solid #e8ecf0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.skeleton-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    border-radius: 16px 16px 0 0;
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 12px;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.medium {
    width: 80%;
}

.skeleton-line.long {
    width: 100%;
}

.skeleton-line.extra-long {
    width: 100%;
    height: 20px;
    margin-bottom: 20px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Card Loading States */
.card-loading {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 24px;
    margin: 15px 0;
    min-height: 580px;
    border: 1px solid #e8ecf0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.card-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    border-radius: 16px 16px 0 0;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 16px;
}

/* Spinner Loader */
.spinner-loader {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Pulse Ring Loader */
.pulse-ring {
    width: 60px;
    height: 60px;
    border: 3px solid #667eea;
    border-radius: 50%;
    animation: pulse-ring 1.5s ease-in-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

/* Wave Loader */
.wave-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 20px 0;
}

.wave-loader div {
    width: 8px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    animation: wave 1.2s ease-in-out infinite;
}

.wave-loader div:nth-child(1) { animation-delay: -1.2s; }
.wave-loader div:nth-child(2) { animation-delay: -1.1s; }
.wave-loader div:nth-child(3) { animation-delay: -1.0s; }
.wave-loader div:nth-child(4) { animation-delay: -0.9s; }
.wave-loader div:nth-child(5) { animation-delay: -0.8s; }

@keyframes wave {
    0%, 40%, 100% {
        transform: scaleY(0.4);
    }
    20% {
        transform: scaleY(1.0);
    }
}

/* ===== GLOBAL LOADER OVERRIDES ===== */
.amz-preloader {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 9999 !important;
}

.amz-preloader .loading-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    width: 100% !important;
}

/* Ensure loaders work in all contexts */
.modern-loader, .dots-loader, .wave-loader, .spinner-loader, .pulse-ring {
    display: block !important;
}

/* Fallback for older browsers */
@supports not (display: flex) {
    .amz-preloader {
        text-align: center !important;
        padding-top: 50px !important;
    }
}

/* ===== UTILITY CLASSES ===== */
.small-text, .highlight {
    display: inline-block;
    vertical-align: middle;
}

.small-text {
    margin-right: 10px;
}

.row {
    margin-right: 0; 
    margin-left: 0px; 
}

#taskTable {
    display: none; 
}

.state-overview .value h1, .state-overview .value p {
    color: #0c42e6 !important;
}