:root {
    --primary-color: #7f54b3;
    /* WooCommerce Purple */
    --secondary-color: #3c3c3c;
    --bg-color: #f0f2f5;
    --text-color: #333;
    --white: #ffffff;
    --border-color: #ddd;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --sidebar-width: 250px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    font-size: 16px;
    /* Base font size for readability */
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-color);
    padding: 20px;
}

.login-box {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 4px;
    border: none;
    transition: background-color 0.15s ease-in-out;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    width: 100%;
}

.btn-primary:hover {
    background-color: #69439b;
}

.alert {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Dashboard Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-color);
    color: var(--white);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 2001;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem;
    text-align: center;
    background-color: #2c2c2c;
}

.sidebar-header h3 {
    margin: 0;
    color: var(--white);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #ccc;
    text-decoration: none;
    transition: color 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: var(--white);
    background-color: rgba(255, 255, 255, 0.1);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    width: calc(100% - var(--sidebar-width));
}

.topbar {
    background-color: var(--white);
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 900;
}

.toggle-sidebar {
    display: none;
    /* Hidden on desktop */
    cursor: pointer;
    font-size: 1.5rem;
    margin-right: 1rem;
    background: none;
    border: none;
    padding: 5px;
    color: var(--text-color);
}

.content-wrapper {
    padding: 2rem;
    flex: 1;
    overflow-x: hidden;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    margin: 0;
    font-size: 1.25rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    /* Ensure table doesn't squash too much */
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid var(--border-color);
    text-align: left;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid var(--border-color);
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .toggle-sidebar {
        display: block !important;
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 950;
    }

    /* .sidebar.active+.sidebar-overlay rule removed as overlay is now in footer */
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }

    .row {
        flex-direction: column;
    }

    .col-8,
    .col-4 {
        width: 100% !important;
        flex: none !important;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
        /* Stack stats on mobile */
    }

    .filters form {
        flex-direction: column;
        width: 100%;
    }

    .filters select,
    .filters input,
    .filters button {
        width: 100% !important;
        margin-bottom: 10px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header .actions {
        width: 100%;
        margin-top: 10px;
    }
}

/* PWA Install Prompt */
.pwa-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    animation: slideUp 0.5s ease-out;
}

.pwa-prompt-content {
    padding: 20px;
    text-align: center;
}

.ios-prompt {
    bottom: 50%;
    transform: translate(-50%, 50%);
    /* Center on screen for iOS instructions */
}

@keyframes slideUp {
    from {
        bottom: -100px;
        opacity: 0;
    }

    to {
        bottom: 20px;
        opacity: 1;
    }
}

/* iOS prompt animation override */
.ios-prompt {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}