/**
 * Inventory System - iOS Vibe CSS
 * Based on CRM CSS Visual Style Guide
 */

:root {
    /* Colors */
    --bg-app: #f2f2f3;
    --bg-app-alt: #f5f5f7;
    --text-main: #141414;
    --text-secondary: #666;
    --brand-dark-1: #151515;
    --brand-dark-2: #2b2b2b;
    --accent: #f7a736;
    --success: #34c759;
    --warning: #ff9500;
    --error: #ff3b30;
    --info: #007aff;

    /* Borders */
    --border-color: rgba(0, 0, 0, 0.1);
    --border-color-light: rgba(0, 0, 0, 0.05);

    /* Radius */
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 18px;

    /* Shadows */
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-modal: 0 10px 26px rgba(0, 0, 0, 0.12);

    /* Transitions */
    --ease-fast: all 0.2s ease;
    --ease-drawer: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, Arial, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--text-main);
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Cards */
.card {
    background: white;
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: var(--ease-fast);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border-color-light);
    padding: 1rem 1.125rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--ease-fast);
    border: none;
    padding: 0.5rem 1rem;
    font-size: 14px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-dark-1), var(--brand-dark-2));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-dark-2), var(--brand-dark-1));
    color: white;
}

.btn-accent {
    background-color: var(--accent);
    color: white;
}

.btn-accent:hover {
    background-color: #e89625;
    color: white;
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-danger {
    background-color: var(--error);
    color: white;
}

.btn-secondary {
    background-color: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 13px;
}

.btn-lg {
    padding: 0.75rem 1.25rem;
    font-size: 15px;
}

/* Form Controls */
.form-control,
.form-select {
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 14px;
    transition: var(--ease-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(247, 167, 54, 0.2);
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.app-header .container-fluid {
    max-width: 1400px;
}

/* Offcanvas Menu */
.offcanvas {
    border: none;
    box-shadow: var(--shadow-modal);
}

.offcanvas-header {
    border-bottom: 1px solid var(--border-color-light);
    padding: 1.5rem;
}

.offcanvas-body {
    padding: 1.5rem;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-square {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--brand-dark-1), var(--brand-dark-2));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    border-radius: var(--radius-sm);
}

/* Navigation */
.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-menu li {
    margin-bottom: 0.5rem;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.875rem 1rem;
    color: var(--text-main);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--ease-fast);
    font-weight: 500;
}

.nav-menu a:hover {
    background-color: var(--bg-app);
    color: var(--text-main);
}

.nav-menu a.active {
    background-color: var(--accent);
    color: white;
}

/* Language Switcher (Pill Style) */
.language-switcher {
    display: inline-flex;
    background: var(--bg-app);
    border-radius: 20px;
    padding: 4px;
    gap: 4px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.language-switcher button {
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    border-radius: 16px;
    transition: var(--ease-fast);
    cursor: pointer;
}

.language-switcher button.active {
    background: white;
    color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.language-switcher button:hover:not(.active) {
    color: var(--text-main);
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
}

@media (max-width: 768px) {
    .main-container {
        padding: 1.25rem 1rem;
    }
}

/* Tables */
.table {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table thead th {
    background-color: var(--bg-app);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-main);
    padding: 0.75rem;
    font-size: 13px;
}

.table tbody td {
    padding: 0.75rem;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: var(--bg-app-alt);
}

/* Badges */
.badge {
    padding: 0.25rem 0.6rem;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px;
}

.badge-success {
    background-color: var(--success);
    color: white;
}

.badge-warning {
    background-color: var(--warning);
    color: white;
}

.badge-danger {
    background-color: var(--error);
    color: white;
}

.badge-info {
    background-color: var(--info);
    color: white;
}

.badge-secondary {
    background-color: var(--text-secondary);
    color: white;
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
}

.alert-success {
    background-color: rgba(52, 199, 89, 0.1);
    color: #1f7a3d;
    border-left: 3px solid var(--success);
}

.alert-danger {
    background-color: rgba(255, 59, 48, 0.1);
    color: #c72020;
    border-left: 3px solid var(--error);
}

.alert-warning {
    background-color: rgba(255, 149, 0, 0.1);
    color: #cc7700;
    border-left: 3px solid var(--warning);
}

.alert-info {
    background-color: rgba(0, 122, 255, 0.1);
    color: #005ebb;
    border-left: 3px solid var(--info);
}

/* Modal */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
}

.modal-header {
    border-bottom: 1px solid var(--border-color-light);
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color-light);
    padding: 1.5rem;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--bg-app), var(--bg-app-alt));
    min-height: 100vh;
}

.bg-dark-brand {
    background: linear-gradient(135deg, var(--brand-dark-1), var(--brand-dark-2));
}

.login-page .logo-square {
    width: 80px;
    height: 80px;
    font-size: 40px;
}

/* Clickable Stats/Counts */
.stat-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: var(--ease-fast);
}

.stat-link:hover {
    color: #e89625;
    text-decoration: underline;
}

/* Loading Spinner */
.spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    border-width: 2px;
}

/* Device Add - Scanner Hybrid UI */
.scanner-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.125rem;
    background: linear-gradient(135deg, #ffffff, var(--bg-app-alt));
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-md);
}

.scanner-toolbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.scanner-toggle-btn {
    min-width: 190px;
}

.scanner-toggle-btn.is-active {
    background: rgba(255, 59, 48, 0.12);
    color: #be2d24;
    border: 1px solid rgba(255, 59, 48, 0.25);
}

.scanner-panel {
    background: #ffffff;
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-card);
}

.scanner-preview-shell {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #0f0f10;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.scanner-preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.scanner-actions .btn {
    min-width: 210px;
}

.photo-preview-thumb {
    max-width: 220px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
}

/* Compact and consistent actions in tables */
.table-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.table-actions form {
    margin: 0;
}

.table-actions .btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    justify-content: center;
}

.table-actions .btn i {
    font-size: 14px;
}

/* Utility Classes */
.text-muted {
    color: var(--text-secondary) !important;
}

.border-light {
    border-color: var(--border-color-light) !important;
}

.bg-light-gray {
    background-color: var(--bg-app);
}

.shadow-card {
    box-shadow: var(--shadow-card);
}

.shadow-hover {
    box-shadow: var(--shadow-hover);
}

/* Responsive */
@media (max-width: 768px) {
    .page-title {
        font-size: 22px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    .btn {
        min-height: 44px;
        justify-content: center;
    }

    .scanner-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .scanner-toggle-btn {
        width: 100%;
        min-width: 0;
    }

    .scanner-actions .btn {
        width: 100%;
        min-width: 0;
    }

    .photo-preview-thumb {
        max-width: 100%;
    }
}