/* Clean, flat design with compatible colors */
:root {
    --primary-dark: #1a1a1a;
    /* --accent-blue: #00bfff; */
    --accent-blue: #007bff;
    --text-white: #ffffff;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --light-bg: #f5f7fa;
    --card-bg: #ffffff;
    --text-dark: #212529;
    --primary-color: --accent-blue;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
}

body {
    background-color: var(--light-bg);
    color: var(--text-dark);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    min-height: 100%;
}

body.layout-with-sidebar,
body.layout-home {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout styles */
.main-header {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.header-logo {
    max-width: 150px;
    height: auto;
}

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

.btn-login:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    color: white;
}

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

.btn-register:hover {
    background-color: #059669;
    border-color: #059669;
    color: white;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    background: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 1050;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar.show {
    left: 0;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.sidebar-logo {
    max-width: 120px;
    height: auto;
}

.sidebar-body {
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-nav .nav-link {
    padding: 0.75rem 1.5rem;
    color: #374151;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background-color: #f3f4f6;
    color: var(--primary-color);
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1045;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
}

@media (max-width: 991.98px) {
    .mobile-menu-btn {
        display: block;
    }
    .desktop-nav {
        display: none;
    }
}

/* Content spacing */
.main-content {
    padding-top: 1rem;
}

body.layout-with-sidebar .main-content,
body.layout-home .main-content {
    flex: 1 0 auto;
}

.site-footer {
    margin-top: auto;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    padding: 1.25rem 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.site-footer a {
    color: #4b5563;
    text-decoration: none;
    font-weight: 600;
}

.site-footer a:hover {
    color: #1f2937;
}

@media (min-width: 992px) {
    .main-content {
        padding-top: 2rem;
    }
}

@media (min-width: 992px) {
    .layout-with-sidebar .sidebar {
        left: 0;
    }
    .layout-with-sidebar .sidebar.show {
        left: 0;
    }
    .layout-with-sidebar .sidebar-overlay {
        display: none;
    }
    .layout-with-sidebar {
        padding-left: 280px;
    }
    .layout-with-sidebar .main-content {
        margin-left: auto;
        margin-right: auto;
        width: 100%;
        padding: 1.5rem 2rem;
    }
}

@media (min-width: 1200px) {
    .layout-with-sidebar .main-content {
        padding: 2rem 2.5rem;
    }
}

/* App layout: sidebar look & feel (AdminLTE-like) */
.layout-with-sidebar .sidebar {
    background: #111827;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.25);
    border-right: 1px solid #1f2937;
}
.layout-with-sidebar .sidebar-header {
    background: #0f172a;
    border-bottom: 1px solid #1f2937;
}
.layout-with-sidebar .sidebar-logo {
    max-width: 120px;
}
.layout-with-sidebar .sidebar-nav .nav-link {
    color: #e5e7eb;
    border-radius: 0.5rem;
    margin: 0.125rem 0.75rem;
}
.layout-with-sidebar .sidebar-nav .nav-link:hover {
    background-color: #1f2937;
    color: #ffffff;
}
.layout-with-sidebar .sidebar-nav .nav-link.active {
    background-color: #2563eb;
    color: #ffffff;
}
.layout-with-sidebar .sidebar-footer {
    background: #0f172a;
    border-top: 1px solid #1f2937;
}
.layout-with-sidebar .sidebar-footer .btn {
    border-color: #334155;
    color: #e5e7eb;
}
.layout-with-sidebar .sidebar-footer .btn:hover {
    background: #1f2937;
    color: #ffffff;
}

/* Dropdown menu styles */
.dropdown-menu {
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    min-width: 200px;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    color: var(--text-dark);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: rgba(0, 191, 255, 0.1);
    color: var(--accent-blue);
}

.dropdown-item svg {
    flex-shrink: 0;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: var(--border-color);
}

.status-badge {
    font-size: 0.75rem;
    background-color: var(--accent-blue);
    color: var(--text-white);
    border: none;
    border-radius: 20px;
}

.table-repairs {
    background-color: var(--card-bg);
    color: var(--text-dark);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table-repairs thead {
    background-color: var(--accent-blue);
    color: var(--text-white);
}

.table-repairs tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.table-repairs tbody tr:hover {
    background-color: rgba(0, 191, 255, 0.05);
}

.repairs-list {
    padding: 1rem;
}

.repair-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.repair-item:hover {
    background-color: rgba(0, 191, 255, 0.05);
}

.repair-number {
    flex: 0 0 120px;
    font-weight: 600;
}

.repair-device {
    flex: 1;
    min-width: 0;
}

.repair-status {
    flex: 0 0 140px;
}

.repair-term {
    flex: 0 0 120px;
}

.repair-updated {
    flex: 0 0 100px;
}

.repair-actions {
    flex: 0 0 120px;
    text-align: right;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: transparent;
    border-bottom: none;
    color: var(--text-dark);
    padding: 1rem 1.25rem 0.25rem;
}

.card-header .card-title,
.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6 {
    margin-bottom: 0;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-dark);
}

.btn-outline-primary {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: transparent;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: var(--text-white);
}

.btn-primary {
    background-color: var(--accent-blue);
    border: none;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #0080ff;
}

.custom-header {
    background-color: var(--primary-dark);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.header-logo a {
    color: var(--accent-blue);
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
}

.header-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2rem;
}

.header-menu a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.header-menu a:hover,
.header-menu a.active {
    color: var(--accent-blue);
    font-weight: 600;
}

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

.profile-info {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.profile-btn {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-white);
}

.profile-name {
    text-align: right;
    font-size: 0.85rem;
}

.profile-name .name {
    display: block;
    font-weight: 600;
}

.profile-name .role {
    display: block;
    color: var(--text-muted);
}

.avatar {
    width: 32px;
    height: 32px;
    background-color: var(--accent-blue);
    color: var(--text-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--primary-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0;
    min-width: 180px;
    display: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.profile-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-white);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.dropdown-menu a:hover {
    background-color: rgba(0, 191, 255, 0.1);
    color: var(--accent-blue);
}

.dropdown-menu .logout {
    color: #ff6b6b;
}

.dropdown-menu hr {
    margin: 0.5rem 0;
    border-color: var(--border-color);
}

@media (max-width: 767px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    .status-badge {
        font-size: 0.7rem;
    }
    .table-repairs {
        font-size: 0.85rem;
    }
    .chat-messages {
        height: 300px;
    }
    .card {
        margin: 0 10px;
    }
    .repairs-list {
        padding: 0.5rem;
    }
    .repair-item {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.75rem 0;
        align-items: stretch;
    }
    .repair-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .repair-number {
        font-size: 0.9rem;
        font-weight: 600;
    }
    .repair-status {
        font-size: 0.85rem;
    }
    .repair-device {
        font-size: 0.85rem;
        line-height: 1.2;
    }
    .repair-term {
        font-size: 0.85rem;
        flex: 1;
    }
    .repair-updated {
        display: none;
    }
    .repair-actions {
        flex-shrink: 0;
    }
    .repair-item .btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
}

.message-bubble {
    display: inline-block;
    max-width: 70%;
    padding: 0.75rem 1.25rem;
    border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user .message-bubble {
    background-color: var(--accent-blue);
    color: var(--text-white);
}

.message.support .message-bubble {
    background-color: #f8f9fa;
    color: var(--text-dark);
}

/* Modern User Menu Styles */
.user-menu-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 50px;
    transition: background-color 0.2s ease;
}

.user-menu-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-blue));
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    overflow: hidden;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-letter {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.user-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.dropdown-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.dropdown.show .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    border: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    min-width: 240px;
    padding: 0;
    margin-top: 0.5rem;
    z-index: 1040;
}

.dropdown-header {
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-bottom: 1px solid #e5e7eb;
    border-radius: 12px 12px 0 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.user-email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.user-dropdown-menu .dropdown-item {
    padding: 0.75rem 1rem;
    border-radius: 0;
    transition: all 0.2s ease;
}

.user-dropdown-menu .dropdown-item:hover {
    background-color: rgba(0, 191, 255, 0.08);
    color: var(--accent-blue);
    /* transform: translateX(2px); */
}

.user-dropdown-menu .dropdown-divider {
    margin: 0;
    border-color: #e5e7eb;
}

.logout-item {
    color: var(--danger-color) !important;
}

.logout-item:hover {
    background-color: rgba(239, 68, 68, 0.08) !important;
    color: var(--danger-color) !important;
}

.logout-item svg {
    color: var(--danger-color);
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .user-menu-btn {
        padding: 0.4rem;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .user-dropdown-menu {
        min-width: 200px;
    }
}