:root {
    --ac-primary: #2563eb;
    --ac-secondary: #f8fafc;
    --ac-text: #0f172a;
    --ac-sidebar-bg: #0f172a;
    --ac-sidebar-hover: #1e293b;
    --ac-sidebar-text: #f1f5f9;
    --ac-border: #e2e8f0;
    --ac-success: #dcfce7;
    --ac-success-text: #166534;
    --ac-warning: #fef9c3;
    --ac-warning-text: #854d0e;
    --ac-danger: #fee2e2;
    --ac-danger-text: #991b1b;
    --ac-info: #e0f2fe;
    --ac-info-text: #075985;
}

.ac-is-dashboard {
    display: flex;
    direction: rtl;
    text-align: right;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    background: #f1f5f9;
    margin: 0;
    padding: 0;
    border-radius: 0;
    font-size: 0.9rem; /* Global scaling down ~10% */
}

/* Fullscreen Specific Styles */
#ac-is-system-root:-webkit-full-screen { width: 100%; height: 100%; overflow-y: auto; background: #f1f5f9; }
#ac-is-system-root:-ms-fullscreen { width: 100%; height: 100%; overflow-y: auto; background: #f1f5f9; }
#ac-is-system-root:fullscreen { width: 100%; height: 100%; overflow-y: auto; background: #f1f5f9; }

#ac-is-system-root:fullscreen .ac-is-sidebar { height: 100vh; position: fixed; top: 0; right: 0; }
#ac-is-system-root:fullscreen .ac-is-main-content { margin-right: 250px; width: calc(100% - 250px); }

/* Vertical Sidebar - Reduced Width ~10% */
.ac-is-sidebar {
    width: 250px;
    background: var(--ac-sidebar-bg);
    color: var(--ac-sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    border-radius: 0;
    z-index: 100;
}

.ac-is-sidebar-logo {
    padding: 25px 15px;
    background: #1e293b;
    text-align: center;
}

.ac-is-sidebar-logo h2 {
    color: #fff;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
}

.ac-is-sidebar-nav {
    margin-top: 8px;
    flex-grow: 1;
}

.ac-is-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #94a3b8;
    text-decoration: none !important;
    transition: all 0.3s;
    font-weight: 500;
    border-radius: 0;
    border-right: 4px solid transparent;
    font-size: 0.85rem;
}

.ac-is-sidebar-nav a:hover {
    background: var(--ac-sidebar-hover);
    color: #fff;
}

.ac-is-sidebar-nav a.active {
    background: var(--ac-sidebar-hover);
    color: #fff;
    border-right-color: var(--ac-primary);
}

/* Main Content Area */
.ac-is-main-content {
    flex-grow: 1;
    padding: 30px;
    background: #f1f5f9;
    transition: margin 0.3s ease;
}

.ac-is-content-inner {
    max-width: 1500px;
    margin: 0 auto;
}

/* Professional Flat Buttons - Scaled Down */
.ac-is-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    background: var(--ac-primary);
    color: #fff !important;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none !important;
    line-height: 1.4;
}

/* Responsive Sidebar */
@media (max-width: 1024px) {
    .ac-is-dashboard {
        flex-direction: column;
    }
    .ac-is-sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    .ac-is-sidebar-nav {
        display: flex;
        overflow-x: auto;
    }
    .ac-is-sidebar-nav a {
        padding: 12px 15px;
        white-space: nowrap;
        border-right: none;
        border-bottom: 4px solid transparent;
    }
    .ac-is-sidebar-nav a.active {
        border-bottom-color: var(--ac-primary);
    }
    #ac-is-system-root:fullscreen .ac-is-main-content { margin-right: 0; width: 100%; }

    .ac-is-cart-area {
        position: static !important;
    }
}

@media (max-width: 768px) {
    .ac-is-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .ac-is-main-content {
        padding: 15px;
    }

    .ac-is-metrics-row {
        gap: 10px;
    }

    .ac-is-metric-card {
        padding: 15px;
    }
}

/* Sales Form Mobile Optimization */
.ac-is-cart-area {
    position: sticky;
    top: 20px;
}

/* Table Optimization - Reduced Row Height & Padding */
.ac-is-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--ac-border);
}

.ac-is-table th {
    background: #f8fafc;
    padding: 12px 15px;
    text-align: right;
    font-weight: 700;
    color: #334155;
    border-bottom: 2px solid var(--ac-border);
    font-size: 0.85rem;
}

.ac-is-table td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--ac-border);
    color: #475569;
    font-size: 0.85rem;
}

/* Quick Sales Mode Toggles */
.ac-is-mode-toggles {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ac-is-mode-box {
    padding: 6px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 4px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #64748b;
    border: 1px solid transparent;
}

.ac-is-mode-box:hover {
    background: #f8fafc;
}

.ac-is-mode-box.active {
    background: var(--ac-primary);
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.ac-is-mode-box .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ac-is-mode-box small {
    font-weight: 700;
    font-size: 0.8rem;
}

/* Mobile Barcode Scanner Professional UI */
#ac-is-reader-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background: #000;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

#ac-is-reader {
    width: 100% !important;
    border: none !important;
}

.ac-is-scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ac-is-scan-frame {
    width: 250px;
    height: 150px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    position: relative;
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
}

.ac-is-scan-frame::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #ef4444;
    box-shadow: 0 0 15px #ef4444;
    animation: scanMove 2s infinite linear;
}

@keyframes scanMove {
    0% { top: 0; }
    50% { top: 100%; }
    100% { top: 0; }
}

.ac-is-scan-corners {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
}

.ac-is-scan-corners::before, .ac-is-scan-corners::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 4px solid var(--ac-primary);
}

/* Top Left */
.ac-is-scan-corners::before { top: 0; left: 0; border-right: none; border-bottom: none; }
/* Top Right - pseudo element hack for 4 corners */
.ac-is-scan-frame-corner-tr { position: absolute; top: -2px; right: -2px; width: 20px; height: 20px; border: 4px solid var(--ac-primary); border-left: none; border-bottom: none; }
.ac-is-scan-frame-corner-bl { position: absolute; bottom: -2px; left: -2px; width: 20px; height: 20px; border: 4px solid var(--ac-primary); border-right: none; border-top: none; }
.ac-is-scan-frame-corner-br { position: absolute; bottom: -2px; right: -2px; width: 20px; height: 20px; border: 4px solid var(--ac-primary); border-left: none; border-top: none; }

.ac-is-scan-status {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 20;
}

.scan-success-flash {
    animation: flashGreen 0.5s ease-out;
}

@keyframes flashGreen {
    0% { background: rgba(5, 150, 105, 0); }
    50% { background: rgba(5, 150, 105, 0.5); }
    100% { background: rgba(5, 150, 105, 0); }
}

/* Card Styles - Scaled Down */
.ac-is-card {
    background: #fff;
    padding: 22px;
    border-radius: 0;
    border: 1px solid var(--ac-border);
}

.ac-is-card h3 {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    color: #64748b;
    font-weight: 600;
}

.ac-is-card .value {
    font-size: 1.8rem;
    font-weight: 800;
}

/* Horizontal Metrics Cards */
.ac-is-metrics-row {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.ac-is-metric-card {
    flex: 1;
    background: #fff;
    padding: 22px;
    border-right: 5px solid var(--ac-primary);
    display: flex;
    align-items: center;
    gap: 22px;
    border: 1px solid var(--ac-border);
    border-right: 5px solid var(--ac-primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ac-is-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.ac-is-metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.ac-is-metric-content {
    flex-grow: 1;
}

.ac-is-metric-title {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 5px;
}

.ac-is-metric-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ac-text);
}

@media (max-width: 768px) {
    .ac-is-metrics-row {
        flex-direction: column;
    }
}

/* Form Styles - Reduced Gaps & Padding */
.ac-is-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.ac-is-form-group {
    margin-bottom: 18px;
}

.ac-is-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.85rem;
}

.ac-is-form-group input,
.ac-is-form-group select,
.ac-is-form-group textarea {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Capsules - Smaller */
.ac-is-capsule {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    font-weight: 600;
}

.capsule-primary { background: var(--ac-info); color: var(--ac-info-text); }
.capsule-success { background: var(--ac-success); color: var(--ac-success-text); }
.capsule-warning { background: var(--ac-warning); color: var(--ac-warning-text); }
.capsule-danger { background: var(--ac-danger); color: var(--ac-danger-text); }

.spin {
    display: inline-block;
    animation: rotate 1.5s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
