:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --header-bg: #ffffff;
    --bg-color: #f1f5f9;
    --text-main: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Global Normalization */
input,
select,
textarea,
button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    border: 1px solid var(--border);
    background: white;
    border-radius: 8px;
    transition: all 0.2s;
}

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Ensure checkboxes and radio buttons are visible */
input[type="checkbox"],
input[type="radio"] {
    -webkit-appearance: checkbox !important;
    -moz-appearance: checkbox !important;
    appearance: checkbox !important;
    width: 18px;
    height: 18px;
    cursor: pointer;
    border: 1px solid #cbd5e1;
}

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

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem !important;
    cursor: pointer;
}

.searchable-select-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.searchable-select-input {
    width: 100% !important;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    box-sizing: border-box;
    cursor: text;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.searchable-select-wrapper select {
    display: none !important;
}

.searchable-results-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 1000;
    margin-top: 4px;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    background: white;
    max-height: 200px;
    overflow-y: auto;
}

.searchable-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

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

.searchable-item:hover,
.searchable-item.selected {
    background: #eff6ff;
    color: #2563eb;
}

.searchable-item.no-results {
    color: #94a3b8;
    text-align: center;
    cursor: default;
}

.searchable-select-wrapper select option {
    padding: 8px;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* Mobile Blocker */
#mobile-blocker {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    color: white;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

@media (max-width: 1024px) {
    #mobile-blocker {
        display: flex;
    }

    #app,
    #login-container {
        display: none !important;
    }
}

/* Header Layout */
#main-header {
    height: 70px;
    background: var(--header-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--shadow);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    gap: 10px;
    align-items: center;
}

.top-nav {
    display: flex;
    gap: 5px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-light);
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    gap: 8px;
    align-items: center;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-name {
    font-weight: 600;
}

#logout-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-light);
}

#logout-btn:hover {
    color: #ef4444;
}

/* Main Content */
#main-content {
    height: calc(100vh - 70px);
    overflow-y: auto;
    padding: 30px;
}

#view-container {
    max-width: 1800px;
    margin: 0 auto;
}

/* Cards & Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.project-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 5px solid #ccc;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.card-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.status-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    background: #f1f5f9;
    border-radius: 4px;
}

.card-users {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.user-badge {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

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

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-main);
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.85rem;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    min-height: 420px;
}

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

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-content {
    background: white;
    width: 800px;
    max-width: 95%;
    padding: 25px;
    border-radius: 12px;
    animation: popIn 0.2s;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes popIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.close-modal {
    cursor: pointer;
    font-size: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

/* Login */
.login-wrapper {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    width: 400px;
    box-shadow: var(--shadow);
}

/* Loader */
.loader-container {
    display: flex;
    justify-content: center;
    padding: 50px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Lang Dropdown */
.lang-dropdown:hover .lang-content {
    display: flex !important;
}

/* Premium Dashboard Styles */
.glass-card {
    background: #ffffff;
    /* Solid white for performance */
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    /* Lighter shadow */
    border-radius: 16px;
    padding: 25px;
    transition: transform 0.2s;
    /* Removed backdrop-filter: blur(10px) to prevent high GPU usage */
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.dashboard-charts-grid,
.dashboard-bottom-grid {
    display: grid;
    gap: 25px;
    margin-top: 25px;
}

/* Desktop Layouts */
@media (min-width: 1024px) {
    .dashboard-charts-grid {
        grid-template-columns: 2fr 1fr;
    }

    .dashboard-bottom-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Mobile/Tablet: Stack them */
@media (max-width: 1023px) {

    .dashboard-charts-grid,
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }
}

.gradient-text {
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.grad-blue {
    background-image: linear-gradient(135deg, #2563eb 0%, #a855f7 100%);
}

.grad-green {
    background-image: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
}

.grad-orange {
    background-image: linear-gradient(135deg, #f97316 0%, #f43f5e 100%);
}

.progress-bar-bg {
    background: #f1f5f9;
    border-radius: 10px;
    height: 8px;
    width: 100%;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-in-out;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 300px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid #cbd5e1;
}

.toast.success {
    border-left-color: #22c55e;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #334155;
}

.toast-close {
    cursor: pointer;
    color: #94a3b8;
    margin-left: 10px;
}

.toast-close:hover {
    color: #64748b;
}

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

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}
/* Modern Permissions UI */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.perm-card {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.perm-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.perm-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #475569;
    font-size: 0.9rem;
    font-weight: 500;
}

.perm-label:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.perm-card input[type="checkbox"]:checked + .perm-label {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #2563eb;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.1);
}

.perm-card input[type="checkbox"]:checked + .perm-label:before {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 2px;
}
