/* Scoped box-sizing */
.ispo-dashboard-layout,
.ispo-dashboard-layout * {
    box-sizing: border-box;
}

/* Layout */
.ispo-dashboard-layout {
    display: block;
    min-height: 600px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    position: relative;
}

.ispo-dashboard-layout::after {
    content: "";
    display: table;
    clear: both;
}

.ispo-dashboard-sidebar {
    width: 260px;
    float: left;
    height: 100%;
    min-height: 600px;
    background-color: #1e293b;
    color: #fff;
    transition: transform 0.3s ease;
    z-index: 10;
    position: relative;
}

.ispo-sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #334155;
}

.ispo-sidebar-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.25rem;
}

.ispo-nav-menu {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ispo-dashboard-main {
    margin-left: 260px;
    display: block;
    background-color: #f8fafc;
    min-height: 600px;
}

.ispo-dashboard-topbar {
    background-color: #fff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ispo-dashboard-topbar h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #0f172a;
}

.ispo-content-area {
    padding: 1.5rem;
    overflow-y: auto;
    height: 100%;
}

.ispo-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: #64748b;
    display: none; /* Hidden on desktop */
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ispo-dashboard-layout {
        display: block;
        position: relative;
        overflow: hidden;
   }

    .ispo-dashboard-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 50;
        transform: translateX(-100%);
        width: 260px;
    }

    .ispo-dashboard-sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    }

    .ispo-dashboard-main {
        width: 100%;
        height: 100%;
        min-height: 600px;
        margin-left: 0;
    }

    .ispo-icon-btn {
        display: block;
    }
}

.ispo-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.ispo-marketplace-grid {
    grid-template-columns: 1fr !important;
}

@media (min-width: 768px) {
    .ispo-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

.ispo-card {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.ispo-card:active {
    transform: scale(0.98);
}

.ispo-card h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: #333;
}

.ispo-card-meta {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.ispo-card-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.status-draft { background: #eee; color: #555; }
.status-submitted { background: #fff3cd; color: #856404; }
.status-approved_for_bidding { background: #d4edda; color: #155724; }
.status-pending { background: #cce5ff; color: #004085; }
.status-info { background: #d1ecf1; color: #0c5460; }
.status-warning { background: #fff3cd; color: #856404; }
.status-success { background: #d4edda; color: #155724; }
.status-error { background: #f8d7da; color: #721c24; }

.ispo-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #1C3D1E;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.ispo-btn:hover {
    background: #f8fdff;
    border: #1C3D1E solid 1px;
    color: #1C3D1E;
}

.ispo-dashboard-nav-btn {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    background: transparent;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.ispo-dashboard-nav-btn:hover {
    background-color: #334155;
    color: #fff;
}

.ispo-dashboard-nav-btn.active {
    background: #1C3D1E;
    color: #fff;
    font-weight: 600;
}

.ispo-dashboard-nav-btn .dashicons {
    color: #94a3b8;
    transition: color 0.2s;
}

.ispo-dashboard-nav-btn:hover .dashicons,
.ispo-dashboard-nav-btn.active .dashicons {
    color: #fff;
}

/* Mobile Bottom Navigation */
.ispo-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #1C3D1E;
    z-index: 9999;
    justify-content: space-around;
    padding: 0;
    height: 56px;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
}

.ispo-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    position: relative;
    border: none;
    color: white;
    font-size: 10px;
    cursor: pointer;
    flex: 1;
    padding: 0;
    height: 100%;
    border-radius: 0;
    transition: background-color 0.2s;
    gap: 2px;
}

.ispo-bottom-nav-item .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: white;
}

.ispo-bottom-nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 14px); /* Position relative to center */
    background-color: #ef4444;
    color: white;
    border-radius: 10px;
    padding: 1px 4px;
    font-size: 9px;
    font-weight: bold;
    line-height: 1;
    min-width: 12px;
    text-align: center;
    border: 1px solid #1C3D1E;
}

/* Pull to Refresh */
.ispo-ptr {
    position: absolute;
    top: 70px; /* Below header */
    left: 0;
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.ispo-ptr.visible { opacity: 1; }
.ispo-ptr .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #64748b;
    transition: transform 0.3s;
}
.ispo-ptr.loading .dashicons {
    animation: ispo-spin 1s infinite linear;
}
@keyframes ispo-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Skeleton Loading */
.ispo-skeleton {
    background-color: #e2e8f0;
    border-radius: 4px;
    margin-bottom: 10px;
    animation: ispo-pulse 1.5s infinite ease-in-out;
}
.ispo-skeleton-title { height: 24px; width: 60%; margin-bottom: 15px; }
.ispo-skeleton-text { height: 14px; width: 100%; }
@keyframes ispo-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* Modal Styles */
.ispo-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.ispo-modal-content {
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Create Order Layout */
.ispo-create-order-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    align-items: flex-start;
}

.ispo-draft-order-container {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    position: sticky;
    top: 1.5rem;
}

.ispo-draft-order-container h4 {
    margin-top: 0;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.ispo-draft-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.ispo-draft-item .ispo-remove-item {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1;
}

.ispo-draft-total {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 2px solid #e2e8f0;
    font-size: 1.1rem;
}

.ispo-add-to-order {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.ispo-pricing-tiers p {
    margin: 0.25rem 0;
    font-size: 0.85rem;
}

@media (max-width: 960px) {
    .ispo-create-order-layout {
        grid-template-columns: 1fr;
    }
}

/* Notification Center */
.ispo-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ef4444;
    color: white;
    border-radius: 50%;
    padding: 2px 5px;
    font-size: 0.7rem;
    font-weight: bold;
    line-height: 1;
}

.ispo-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    display: none;
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
}

.ispo-dropdown-menu.active {
    display: block;
}

.ispo-notification-item {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.ispo-notification-item:last-child {
    border-bottom: none;
}

.ispo-table-responsive {
    overflow-x: auto;
}

/* Timeline Styles */
.ispo-timeline-container {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
.ispo-timeline-step {
    text-align: center;
    flex-basis: 0;
    flex-grow: 1;
    position: relative;
    color: #94a3b8;
}
.ispo-timeline-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e2e8f0;
    border: 2px solid #e2e8f0;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    transition: all 0.3s ease;
}
.ispo-timeline-label {
    font-size: 0.8rem;
    font-weight: 500;
    transition: color 0.3s ease;
}
.ispo-timeline-connector {
    flex: 1;
    height: 2px;
    background: #e2e8f0;
    margin-top: 14px;
    transition: background-color 0.3s ease;
}
/* Active State */
.ispo-timeline-step.active .ispo-timeline-icon { background: #3b82f6; border-color: #3b82f6; }
.ispo-timeline-step.active .ispo-timeline-label { color: #1e293b; font-weight: 600; }
/* Completed State */
.ispo-timeline-step.completed .ispo-timeline-icon { background: #10b981; border-color: #10b981; }
.ispo-timeline-step.completed .ispo-timeline-icon::before { content: '✓'; }
.ispo-timeline-step.completed .ispo-timeline-label { color: #334155; }
.ispo-timeline-step.completed + .ispo-timeline-connector { background: #10b981; }
/* Error State */
.ispo-timeline-step.error .ispo-timeline-icon { background: #ef4444; border-color: #ef4444; }
.ispo-timeline-step.error .ispo-timeline-icon::before { content: '✕'; }
.ispo-timeline-step.error .ispo-timeline-label { color: #ef4444; }

.ispo-product-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
    background-color: #f1f5f9;
}

.ispo-view-desc {
    display: inline-block;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: #1C3D1E;
    text-decoration: none;
    font-weight: 500;
}

.ispo-view-desc:hover {
    text-decoration: underline;
}

.ispo-modern-table {
    width: 100%;
    border-collapse: collapse;
}
.ispo-modern-table th, .ispo-modern-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

/* Mobile Adjustments for Bottom Nav */
@media (max-width: 768px) {
    .ispo-bottom-nav {
        display: flex;
    }
    .ispo-dashboard-main {
        padding-bottom: 70px; /* Prevent content from being hidden behind bottom nav */
    }
    .ispo-bottom-nav-item.active {
        background-color: #005a87;
        color: white;
        font-weight: 600;
    }
    .ispo-bottom-nav-item.active .dashicons {
        color: white;
    }
}