/* GPS Portal - Modern Elegant Styling */

:root {
    /* Color palette */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    /* Neutral colors */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.3;
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-700);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
}

.sidebar-logo svg {
    width: 40px;
    height: 40px;
}

.sidebar-logo h1 {
    font-size: 1.25rem;
    color: white;
    font-weight: 700;
}

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

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    padding: 0 1.5rem;
    margin-bottom: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--gray-300);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--gray-800);
    color: white;
}

.nav-item.active {
    background: var(--gray-800);
    color: white;
    border-left-color: var(--primary);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Collapsible Submenus */
.nav-submenu {
    margin-bottom: 0;
}

.nav-parent {
    justify-content: flex-start;
    position: relative;
}

.nav-parent .submenu-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.nav-parent.expanded .submenu-arrow {
    transform: rotate(180deg);
}

.submenu-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--gray-800);
}

.submenu-items.expanded {
    max-height: 400px;
}

.nav-child {
    padding-left: 2.5rem;
    font-size: 0.875rem;
    border-left: none;
}

.nav-child:hover {
    background: var(--gray-700);
}

.nav-child.active {
    background: var(--gray-700);
    border-left: none;
    color: var(--primary-light);
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gray-500);
    flex-shrink: 0;
}

.nav-child:hover .nav-dot,
.nav-child.active .nav-dot {
    background: var(--primary-light);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Mobile menu toggle button */
.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--gray-700);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.menu-toggle:hover {
    background: var(--gray-100);
}

.menu-toggle:active {
    background: var(--gray-200);
}

/* Sidebar backdrop for mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Page Content */
.page-content {
    padding: 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* Mini stat cards for device summary */
.mini-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow) !important;
}

.summary-group.installed .mini-stat:hover {
    border: 2px solid #10b981;
}

.summary-group.to-install .mini-stat:hover {
    border: 2px solid #f59e0b;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue { background: #dbeafe; color: var(--primary); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.yellow { background: #fef3c7; color: var(--warning); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn svg {
    width: 18px;
    height: 18px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
}

.table th[data-sort] {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.table th[data-sort]:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.table th .sort-icon {
    font-size: 0.65rem;
    margin-left: 4px;
    opacity: 0.7;
}

.table th.sort-asc,
.table th.sort-desc {
    background: var(--gray-100);
    color: var(--primary);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody tr.selected,
.table tbody tr.client-row.selected {
    background: #dbeafe;
    border-left: 3px solid var(--primary);
}

.table tbody tr.client-row {
    transition: background 0.15s ease;
}

.table tbody tr.client-row:hover {
    background: #eff6ff;
}

.table td {
    font-size: 0.875rem;
}

/* Tabs */
.tabs-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.tabs {
    display: flex;
    gap: 0.5rem;
}

.tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    transition: var(--transition);
}

.tab:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.tab.active {
    background: var(--primary);
    color: white;
}

.tab svg {
    flex-shrink: 0;
}

.tab-content {
    display: block;
}

.tab-content.hidden {
    display: none;
}

/* Installation Steps */
.install-steps {
    display: flex;
    align-items: center;
    justify-content: center;
}

.install-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
    transition: var(--transition);
}

.install-step.active .step-number {
    background: var(--primary);
    color: white;
}

.install-step.completed .step-number {
    background: var(--success);
    color: white;
}

.step-label {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.install-step.active .step-label {
    color: var(--primary);
}

.install-step.completed .step-label {
    color: var(--success);
}

.step-connector {
    width: 80px;
    height: 3px;
    background: var(--gray-200);
    margin: 0 0.5rem;
    margin-bottom: 1.5rem;
}

.step-connector.completed {
    background: var(--success);
}

.install-content {
    max-width: 800px;
    margin: 0 auto;
}

.install-content.hidden {
    display: none;
}

.selected-info.hidden {
    display: none;
}

/* Selection Items */
.selection-item {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selection-item:hover {
    background: var(--gray-50);
}

.selection-item.selected {
    background: #dbeafe;
    border-left: 3px solid var(--primary);
}

.selection-item:last-child {
    border-bottom: none;
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    background: white;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Search */
.search-box {
    position: relative;
    max-width: 320px;
}

.search-box input {
    padding-left: 2.5rem;
}

.search-box svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: var(--gray-200); color: var(--gray-700); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0.5rem;
}

.modal-close:hover {
    color: var(--gray-600);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Scanner */
.scanner-container {
    background: var(--gray-900);
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
}

#scanner-video {
    width: 100%;
    display: block;
}

.scanner-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    border: 3px solid var(--primary);
    border-radius: var(--border-radius-sm);
}

.scanner-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: var(--primary);
    animation: scan 2s linear infinite;
}

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

/* Toast */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: white;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
}

.login-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header svg {
    width: 64px;
    height: 64px;
    color: var(--primary);
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--gray-500);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    color: var(--gray-300);
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: var(--transition);
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 100;
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex !important;
    }

    .header {
        padding: 0 1rem;
        gap: 0.5rem;
    }

    .header-title {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hide username on small mobile */
    .user-menu span {
        display: none;
    }

    .user-menu {
        padding: 0.5rem;
    }
}

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

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Utility Classes */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Service Tehnic Steps */
.service-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.service-step .step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.service-step .step-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: center;
}

.service-step.active .step-number {
    background: var(--success);
    color: white;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.service-step.active .step-label {
    color: var(--success);
    font-weight: 500;
}

.service-step.completed .step-number {
    background: var(--success);
    color: white;
}

.service-step.completed .step-label {
    color: var(--gray-600);
}

/* Mobile Optimizations for Service Page */
@media (max-width: 768px) {
    #page-service .card {
        border-radius: var(--border-radius-sm);
    }

    #page-service .card-body {
        padding: 1rem;
    }

    #page-service .btn-lg {
        padding: 1rem;
        font-size: 1rem;
    }

    #page-service .form-input,
    #page-service .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .service-step .step-label {
        display: none;
    }

    .service-step .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .service-header {
        padding: 1rem !important;
    }

    .service-header h2 {
        font-size: 1.25rem !important;
    }

    .service-header p {
        font-size: 0.875rem;
    }
}

/* QR Scanner Container */
#serviceQrReader {
    border-radius: var(--border-radius);
    overflow: hidden;
}

#serviceQrReader video {
    border-radius: var(--border-radius);
}

/* Touch-friendly selection items */
#serviceClientsList .selection-item:active {
    background: var(--gray-100);
}

/* Large touch targets for mobile */
@media (pointer: coarse) {
    #page-service .btn {
        min-height: 48px;
    }

    #page-service input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }

    #page-service label {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
}

/* ============================================
   MOBILE OPTIMIZATIONS FOR TEHNIC PAGES
   ============================================ */

/* Base mobile styles for all tehnic pages */
#page-tehnic,
#page-mutare,
#page-dezinstalare,
#page-verificare {
    max-width: 100%;
}

/* Mobile-first card styling */
@media (max-width: 768px) {
    #page-tehnic .card,
    #page-mutare .card,
    #page-dezinstalare .card,
    #page-verificare .card {
        border-radius: 12px;
        margin-bottom: 1rem;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }

    #page-tehnic .card-body,
    #page-mutare .card-body,
    #page-dezinstalare .card-body,
    #page-verificare .card-body {
        padding: 1rem;
    }

    /* Large touch-friendly buttons */
    #page-tehnic .btn,
    #page-mutare .btn,
    #page-dezinstalare .btn,
    #page-verificare .btn {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.875rem 1.25rem;
        border-radius: 10px;
    }

    /* Large primary action buttons */
    #page-mutare .btn-success,
    #page-dezinstalare .btn-danger,
    #page-verificare .btn-primary,
    #page-service .btn-success {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        font-weight: 600;
        min-height: 56px;
    }

    /* Prevent iOS zoom on input focus */
    #page-tehnic input,
    #page-tehnic select,
    #page-tehnic textarea,
    #page-mutare input,
    #page-mutare select,
    #page-mutare textarea,
    #page-dezinstalare input,
    #page-dezinstalare select,
    #page-dezinstalare textarea,
    #page-verificare input,
    #page-verificare select,
    #page-verificare textarea {
        font-size: 16px !important;
        min-height: 48px;
        border-radius: 10px;
    }

    /* Better textarea sizing */
    #page-mutare textarea,
    #page-dezinstalare textarea,
    #page-verificare textarea {
        min-height: 100px;
    }

    /* Step indicators - smaller on mobile */
    #page-mutare .service-step .step-label,
    #page-dezinstalare .service-step .step-label,
    #page-verificare .service-step .step-label {
        display: none;
    }

    #page-mutare .service-step .step-number,
    #page-dezinstalare .service-step .step-number,
    #page-verificare .service-step .step-number {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    /* Page headers */
    #page-tehnic h2,
    #page-mutare h2,
    #page-dezinstalare h2,
    #page-verificare h2 {
        font-size: 1.25rem;
    }

    /* Stats cards on tehnic page */
    #page-tehnic .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    #page-tehnic .stat-card {
        padding: 1rem;
    }

    #page-tehnic .stat-value {
        font-size: 1.5rem;
    }

    /* Quick action buttons grid */
    #page-tehnic .grid {
        gap: 0.75rem;
    }

    /* Photo upload container */
    #page-mutare #mutarePhotosContainer,
    #page-dezinstalare #dezinstalarePhotosContainer,
    #page-verificare #verificarePhotosContainer {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Photo preview thumbnails */
    #page-mutare #mutarePhotosContainer > div,
    #page-dezinstalare #dezinstalarePhotosContainer > div,
    #page-verificare #verificarePhotosContainer > div {
        width: 70px !important;
        height: 70px !important;
    }

    /* Add photo button */
    #page-mutare #mutarePhotosContainer label,
    #page-dezinstalare #dezinstalarePhotosContainer label,
    #page-verificare #verificarePhotosContainer label {
        width: 70px;
        height: 70px;
        min-width: 70px;
    }

    /* Radio button groups - larger touch targets */
    #page-verificare .radio-group {
        display: flex;
        gap: 1rem;
    }

    #page-verificare .radio-group label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        background: var(--gray-100);
        border-radius: 8px;
        cursor: pointer;
        min-height: 48px;
    }

    #page-verificare .radio-group input[type="radio"] {
        width: 20px;
        height: 20px;
        min-height: 20px;
    }

    /* Device info display */
    #mutareDeviceInfo,
    #dezinstalareDeviceInfo,
    #verificareDeviceInfo {
        font-size: 0.95rem;
    }

    #mutareDeviceInfo code,
    #dezinstalareDeviceInfo code,
    #verificareDeviceInfo code {
        font-size: 0.85rem;
        word-break: break-all;
    }

    /* Summary sections */
    #mutareSummary,
    #dezinstalareSummary,
    #verificareSummary {
        font-size: 0.95rem;
    }

    /* Back button positioning */
    #page-mutare .btn-secondary,
    #page-dezinstalare .btn-secondary,
    #page-verificare .btn-secondary {
        min-width: 100px;
    }

    /* Full width buttons on mobile */
    #page-mutare .card-body > .flex,
    #page-dezinstalare .card-body > .flex,
    #page-verificare .card-body > .flex {
        flex-direction: column;
        gap: 0.75rem;
    }

    #page-mutare .card-body > .flex > .btn,
    #page-dezinstalare .card-body > .flex > .btn,
    #page-verificare .card-body > .flex > .btn {
        width: 100%;
    }
}

/* Touch device optimizations */
@media (pointer: coarse) {
    #page-tehnic .btn,
    #page-mutare .btn,
    #page-dezinstalare .btn,
    #page-verificare .btn {
        min-height: 48px;
    }

    #page-tehnic .selection-item,
    #page-mutare .selection-item,
    #page-dezinstalare .selection-item,
    #page-verificare .selection-item {
        min-height: 56px;
        padding: 1rem;
    }

    /* Larger checkboxes and radios */
    #page-tehnic input[type="checkbox"],
    #page-tehnic input[type="radio"],
    #page-mutare input[type="checkbox"],
    #page-mutare input[type="radio"],
    #page-dezinstalare input[type="checkbox"],
    #page-dezinstalare input[type="radio"],
    #page-verificare input[type="checkbox"],
    #page-verificare input[type="radio"] {
        width: 24px;
        height: 24px;
    }

    /* Better spacing for form labels */
    #page-tehnic label,
    #page-mutare label,
    #page-dezinstalare label,
    #page-verificare label {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Very small screens (phones in portrait) */
@media (max-width: 480px) {
    #page-tehnic .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    #page-tehnic .stat-card {
        padding: 0.75rem;
    }

    #page-tehnic .stat-value {
        font-size: 1.25rem;
    }

    #page-tehnic .stat-label {
        font-size: 0.7rem;
    }

    /* Make scanner button more prominent */
    #page-mutare .btn[onclick*="Scanner"],
    #page-dezinstalare .btn[onclick*="Scanner"],
    #page-verificare .btn[onclick*="Scanner"] {
        padding: 1rem;
    }

    /* Search input with full width */
    #mutareDeviceSearch,
    #dezinstalareDeviceSearch,
    #verificareDeviceSearch {
        width: 100%;
    }

    /* Step content padding */
    #page-mutare .step-content,
    #page-dezinstalare .step-content,
    #page-verificare .step-content {
        padding: 0.5rem 0;
    }
}

/* QR Scanner styling for tehnic pages */
#mutareQrReader,
#dezinstalareQrReader,
#verificareQrReader {
    border-radius: 12px;
    overflow: hidden;
    max-width: 100%;
}

#mutareQrReader video,
#dezinstalareQrReader video,
#verificareQrReader video {
    border-radius: 12px;
    max-width: 100%;
}

/* Platform badge styling */
.platform-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
}

.platform-badge.etrack { background: #3b82f6; }
.platform-badge.hosting { background: #22c55e; }
.platform-badge.axios { background: #f59e0b; }
.platform-badge.agricloud { background: #8b5cf6; }

/* Loading spinner for search */
.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--gray-500);
}

/* Intervention list on tehnic page - mobile friendly */
@media (max-width: 768px) {
    #page-tehnic .table-container {
        font-size: 0.85rem;
        margin: 0 -0.5rem;
    }

    #page-tehnic .table th,
    #page-tehnic .table td {
        padding: 0.6rem 0.4rem;
    }

    #page-tehnic .table {
        min-width: auto;
    }

    /* Hide less important columns on mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Compact badges on mobile */
    #page-tehnic .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    /* Touch-friendly rows */
    #page-tehnic .table tbody tr {
        border-bottom: 1px solid var(--gray-200);
    }

    #page-tehnic .table tbody tr:active {
        background-color: var(--gray-100);
    }

    /* Quick action buttons grid */
    #page-tehnic .quick-actions {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Even smaller screens - stack quick actions 2x2 */
@media (max-width: 480px) {
    #page-tehnic .quick-actions {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    #page-tehnic .quick-actions button {
        padding: 0.75rem !important;
    }

    #page-tehnic .quick-actions button svg {
        width: 24px !important;
        height: 24px !important;
    }

    #page-tehnic .quick-actions button span {
        font-size: 0.7rem !important;
    }

    /* Make filters stack on very small screens */
    #page-tehnic .filters-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ============ Exchange Rate Widget in Header ============ */
.exchange-rate-widget {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--gray-800);
    border-radius: var(--border-radius-sm);
    margin-right: 1rem;
    cursor: default;
}

.exchange-rate-widget .rate-label {
    color: var(--gray-400);
    font-size: 0.75rem;
    font-weight: 500;
}

.exchange-rate-widget .rate-value {
    color: var(--success);
    font-size: 0.875rem;
    font-weight: 600;
}

/* ============ Tabs Styling ============ */
.tabs-container {
    background: var(--gray-900);
    border-radius: var(--border-radius);
    padding: 0.25rem;
}

.tabs-header {
    display: flex;
    gap: 0;
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--gray-400);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}

.tab-btn:hover {
    color: var(--gray-200);
    background: var(--gray-800);
}

.tab-btn.active {
    color: var(--primary-light);
    background: var(--gray-800);
    border-radius: var(--border-radius-sm);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

.tab-content {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive tabs */
@media (max-width: 768px) {
    .tabs-header {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-btn {
        flex: 0 0 auto;
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }
    
    .exchange-rate-widget {
        display: none;
    }
}

/* ============================================
   NOTIFICATIONS SYSTEM
   ============================================ */

.notifications-wrapper {
    position: relative;
}

.notifications-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    position: relative;
    transition: var(--transition);
}

.notifications-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.notifications-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    z-index: 1000;
    display: none;
    max-height: 480px;
    overflow: hidden;
}

.notifications-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.notifications-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.notification-item:hover {
    background: var(--gray-50);
}

.notification-item.unread {
    background: #eff6ff;
    border-left: 3px solid var(--primary);
}

.notification-item.unread:hover {
    background: #dbeafe;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.ticket {
    background: #dbeafe;
    color: var(--primary);
}

.notification-icon.alert-triangle,
.notification-icon.alert-circle {
    background: #fef3c7;
    color: var(--warning);
}

.notification-icon.bell {
    background: var(--gray-100);
    color: var(--gray-600);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.8rem;
    color: var(--gray-600);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

.notification-item.priority-high .notification-icon {
    background: #fee2e2;
    color: var(--danger);
}

/* Responsive */
@media (max-width: 768px) {
    .notifications-dropdown {
        position: fixed;
        top: var(--header-height);
        right: 0;
        left: 0;
        width: 100%;
        border-radius: 0;
        max-height: calc(100vh - var(--header-height));
    }
}
