:root {
    --shopify-sidebar-bg: #f3f3f3;
    --shopify-sidebar-hover: #ebebeb;
    --shopify-sidebar-active: #ffffff;
    --shopify-text-primary: #1a1c1d;
    --shopify-text-secondary: #616161;
    --shopify-border: #e1e3e5;
    --shopify-accent: #008060;
    --shopify-accent-hover: #006e52;
    --shopify-bg-main: #f6f6f7;
    --shopify-card-bg: #ffffff;
    --shopify-card-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--shopify-bg-main);
    color: var(--shopify-text-primary);
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 240px;
    background-color: var(--shopify-sidebar-bg);
    border-right: 1px solid var(--shopify-border);
    padding: 12px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-sidebar-item {
    padding: 4px 12px;
}

.admin-sidebar-link {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--shopify-text-primary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.admin-sidebar-link:hover {
    background-color: var(--shopify-sidebar-hover);
}

.admin-sidebar-link.active {
    background-color: var(--shopify-sidebar-active);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.admin-sidebar-link i {
    width: 24px;
    margin-right: 12px;
    font-size: 18px;
    color: var(--shopify-text-secondary);
}

.admin-sidebar-link.active i {
    color: var(--shopify-accent);
}

.admin-sidebar-section-title {
    padding: 16px 24px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--shopify-text-secondary);
    letter-spacing: 0.5px;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 240px;
    padding: 24px 40px;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Top Bar */
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 40px;
    background-color: var(--shopify-sidebar-bg);
    border-bottom: 1px solid var(--shopify-border);
    margin-bottom: 24px;
}

.admin-topbar-title {
    font-size: 14px;
    font-weight: 600;
}

/* Cards */
.admin-card {
    background: var(--shopify-card-bg);
    border-radius: 12px;
    box-shadow: var(--shopify-card-shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.admin-card-title {
    font-size: 14px;
    font-weight: 600;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: var(--shopify-card-shadow);
}

.stat-label {
    font-size: 12px;
    color: var(--shopify-text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
}

/* Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    padding: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--shopify-text-secondary);
    border-bottom: 1px solid var(--shopify-border);
}

.admin-table td {
    padding: 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--shopify-border);
}

.admin-table tr:hover {
    background-color: #f9f9f9;
}

/* Status Badges */
.badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success { background: #e3f1df; color: #008060; }
.badge-warning { background: #fff4e5; color: #b98900; }
.badge-error, .badge-danger { background: #fbeae5; color: #8a110b; }
.badge-info { background: #e3f2fd; color: #0d47a1; }
.badge-processing { background: #f0f1f2; color: #4a4d50; }
.badge-secondary { background: #f1f2f3; color: #6d7175; }

/* Buttons */
.btn-primary {
    background-color: var(--shopify-accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: var(--shopify-accent-hover);
}

.btn-secondary {
    background-color: white;
    color: var(--shopify-text-primary);
    border: 1px solid var(--shopify-border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary:hover {
    background-color: #f6f6f7;
}

/* Mobile Responsiveness & Layout Fixes */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 70px;
        padding: 12px 0;
        z-index: 1001;
    }
    .admin-sidebar span, .admin-sidebar-section-title {
        display: none;
    }
    .admin-sidebar-link i {
        margin-right: 0;
        width: 100%;
        text-align: center;
        font-size: 20px;
    }
    .admin-main {
        margin-left: 70px;
        padding: 20px;
    }
    .admin-topbar {
        padding: 12px 20px;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 2000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        display: block;
        background: #fff;
    }
    .admin-sidebar.active {
        left: 0;
    }
    .admin-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1999;
    }
    .admin-sidebar-overlay.active {
        display: block;
    }
    .admin-sidebar span, .admin-sidebar-section-title {
        display: block;
    }
    .admin-sidebar-link i {
        margin-right: 12px;
        width: 24px;
        text-align: left;
    }
    .admin-main {
        margin-left: 0;
        padding: 16px;
        width: 100%;
        overflow-x: hidden;
        max-width: 100vw;
        box-sizing: border-box;
    }
    .admin-topbar {
        position: sticky;
        top: 0;
        z-index: 100;
        background: #fff;
        padding: 10px 16px;
        margin-bottom: 16px;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        box-sizing: border-box;
        width: 100%;
    }
    .admin-topbar-title {
        font-weight: 700;
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .admin-topbar > div:last-child {
        display: flex;
        align-items: center;
        gap: 8px;
        overflow-x: auto;
        padding: 4px 0;
        max-width: 60%;
    }
    .admin-topbar input[type="text"] {
        width: 120px !important;
        transition: width 0.3s;
    }
    .admin-topbar input[type="text"]:focus {
        width: 200px !important;
    }
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: #f3f3f3;
        border-radius: 8px;
        cursor: pointer;
        color: var(--shopify-text-primary);
        flex-shrink: 0;
    }
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .stat-card {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px;
    }
    .stat-label {
        margin-bottom: 0;
        font-weight: 500;
    }
    .stat-value {
        font-size: 18px;
    }
    .admin-card {
        padding: 16px;
        margin-bottom: 16px;
        width: 100%;
        box-sizing: border-box;
    }
    .admin-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: none;
    }
    .admin-table thead {
        display: none;
    }
    .admin-table tbody, .admin-table tr, .admin-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .admin-table tr {
        margin-bottom: 16px;
        background: #fff;
        border: 1px solid var(--shopify-border);
        border-radius: 12px;
        padding: 4px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }
    .admin-table td {
        text-align: right;
        padding: 10px 12px;
        border-bottom: 1px solid #f6f6f7;
        position: relative;
        min-height: 44px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 13px;
    }
    .admin-table td:last-child {
        border-bottom: none;
        justify-content: center;
        background: #f9f9f9;
        margin-top: 4px;
        border-radius: 0 0 8px 8px;
        padding: 12px;
    }
    .admin-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--shopify-text-secondary);
        font-size: 11px;
        text-transform: uppercase;
        margin-right: 16px;
    }
    .admin-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .admin-card-header > div {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 8px;
        display: flex;
        gap: 12px;
        scrollbar-width: none;
    }
    .admin-card-header > div::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 480px) {
    .admin-topbar-title {
        font-size: 18px;
    }
    .admin-main {
        padding: 12px;
    }
}
