:root {
    /* Color Palette */
    --primary: #0f172a;
    /* Navy Blue */
    --primary-light: #1e3a8a;
    --primary-lighter: #2563eb;
    --secondary: #f8fafc;
    --background: #ffffff;
    --surface: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;

    /* Green Accent touches from the logo */
    --logo-green: #059669;
    --logo-green-hover: #047857;
    --logo-green-light: #ecfdf5;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;

    /* Shadows & Radii */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-md: 8px;
    --radius-lg: 12px;

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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--secondary);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1,
h2,
h3,
h4 {
    color: var(--primary);
    font-weight: 600;
}

a {
    color: var(--primary-lighter);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-size: 1rem;
}

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

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-1px);
}

.btn-icon {
    padding: 10px;
    background-color: var(--secondary);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 50%;
}

.btn-icon:hover {
    background-color: var(--border);
}

.btn-block {
    width: 100%;
}

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

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

/* Navbar */
.navbar {
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo-img {
    height: 180px;
    object-fit: contain;
    margin: -30px 0;
    background: transparent;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: var(--text-light);
    font-weight: 500;
    padding: 5px 10px;
}

.nav-link.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* User Switcher */
.user-switcher {
    position: relative;
}

.current-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    border: 1px solid var(--border);
}

.current-user:hover {
    background-color: var(--secondary);
}

.current-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.dropdown-menu {
    position: absolute;
    top: 110%;
    right: 0;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    width: 250px;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-menu a {
    padding: 12px 15px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.dropdown-menu a:hover {
    background-color: var(--secondary);
    color: var(--primary);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    width: 100%;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

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

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

/* Hero & Search */
.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.hero p {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.search-bar {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.search-bar input {
    width: 100%;
    padding: 15px 20px 15px 50px;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 1.1rem;
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--logo-green);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* Categories */
.categories {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 40px;
}

.category-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 20px;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
    font-weight: 500;
}

.category-btn:hover {
    border-color: var(--logo-green);
    color: var(--logo-green);
}

.category-btn.active {
    background-color: var(--logo-green);
    color: white;
    border-color: var(--logo-green);
}

/* Grid & Cards */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

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

.item-card .img-container {
    height: 200px;
    overflow: hidden;
    position: relative;
}

.item-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.item-card:hover img {
    transform: scale(1.05);
}

.item-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--warning);
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
}

.item-info {
    padding: 20px;
}

.item-info h3 {
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.tag {
    display: inline-block;
    padding: 4px 8px;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.item-meta {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
}

.status.available {
    background: var(--success-light);
    color: var(--success);
}

.status.rented {
    background: var(--warning-light);
    color: var(--warning);
}

.status.pending {
    background: var(--danger-light);
    color: var(--danger);
}

/* Publish Form & Charter */
.publish-container,
.charter-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
}

.publish-container h2,
.charter-container h2 {
    margin-bottom: 30px;
    text-align: center;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.important-label {
    color: var(--danger);
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

input[type="text"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    border-color: var(--logo-green);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.checkbox-group input {
    margin-top: 5px;
    accent-color: var(--logo-green);
}

.file-upload-wrapper {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    background: var(--secondary);
    transition: var(--transition);
}

.file-upload-wrapper:hover {
    border-color: var(--logo-green);
    background: rgba(5, 150, 105, 0.02);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-area i {
    font-size: 2rem;
    color: var(--logo-green);
    margin-bottom: 10px;
}

.photo-preview-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.photo-preview {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1px solid var(--border);
}

.error-text {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Charter Content */
.charter-content h3 {
    margin-top: 25px;
    margin-bottom: 10px;
    color: var(--primary-light);
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 30px;
}

.dash-section {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.dash-section h3 {
    margin-bottom: 20px;
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 10px;
}

.dash-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dash-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--secondary);
}

.dash-item-info strong {
    display: block;
    font-size: 1.1rem;
}

.dash-actions {
    display: flex;
    gap: 10px;
}

/* Admin Table */
.admin-panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-top: 20px;
}

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

.admin-table th,
.admin-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--secondary);
    font-weight: 600;
}

.admin-table img {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface);
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

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

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.modal-image-gallery {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-image-gallery img {
    width: 100%;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.modal-image-gallery .main-img {
    height: 300px;
}

.modal-image-gallery .thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
}

.modal-image-gallery .thumbnails img {
    width: 80px;
    height: 80px;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
}

.modal-image-gallery .thumbnails img:hover,
.modal-image-gallery .thumbnails img.active {
    opacity: 1;
    border: 2px solid var(--primary);
}

.flaws-alert {
    background: var(--danger-light);
    border-left: 4px solid var(--danger);
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.flaws-alert h4 {
    color: var(--danger);
    margin-bottom: 5px;
}

.loan-info {
    background: var(--secondary);
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.borrow-form {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--background);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary);
    color: white;
    padding: 15px 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-body {
        grid-template-columns: 1fr;
    }

    .nav-links {
        display: none;
    }

    .hero h1 {
        font-size: 2rem;
    }

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

/* SSO styling and Dropdown Header */
.sso-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--logo-green-light);
    color: var(--logo-green);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(5, 150, 105, 0.15);
}

.dropdown-header {
    padding: 10px 15px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    background-color: var(--secondary);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sso-info-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--logo-green-light);
    color: var(--logo-green);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-weight: 500;
    margin-bottom: 20px;
    border: 1px solid rgba(5, 150, 105, 0.1);
}

/* Admin Sub-Tabs Navigation */
.admin-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 25px;
    padding-bottom: 2px;
}

.admin-tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom: 3px solid transparent;
}

.admin-tab-btn:hover {
    color: var(--primary);
    background-color: var(--secondary);
}

.admin-tab-btn.active {
    color: var(--logo-green);
    border-bottom: 3px solid var(--logo-green);
    font-weight: 600;
}

.admin-tab-content {
    display: none;
    animation: fadeIn 0.25s ease;
}

.admin-tab-content.active {
    display: block;
}

/* Split Layout for Admin Panel */
.admin-panel-split {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

@media (max-width: 992px) {
    .admin-panel-split {
        flex-direction: column;
    }

    .admin-panel-split>.invite-card {
        width: 100% !important;
    }
}

/* Simulator Email Widget styling */
.email-widget {
    position: fixed;
    bottom: 0;
    right: 30px;
    width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
    transform: translateY(calc(100% - 48px));
    /* 48px header visible */
}

.email-widget.expanded {
    transform: translateY(0);
}

.email-widget-header {
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    user-select: none;
}

.email-widget-header i {
    transition: transform 0.3s ease;
}

.email-widget.expanded #email-widget-icon {
    transform: rotate(180deg);
}

.email-widget-body {
    height: 350px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
}

.email-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.email-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    transition: var(--transition);
}

.email-item:hover {
    background-color: var(--secondary);
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-weight: 600;
}

.email-item-to {
    color: var(--logo-green);
    font-weight: 600;
}

.email-item-subject {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
}

.email-item-body {
    color: var(--text-light);
    line-height: 1.4;
    white-space: pre-line;
}

.email-badge {
    background-color: var(--danger);
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

/* Login Portal Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 75vh;
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    padding: 40px;
    text-align: center;
    animation: fadeIn 0.4s ease;
}

.login-logo {
    height: 140px;
    object-fit: contain;
    margin-bottom: 10px;
}

.login-header h2 {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 30px;
}

.btn-sso {
    background-color: var(--logo-green);
    font-size: 1.05rem;
    padding: 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
}

.btn-sso:hover {
    background-color: var(--logo-green-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 25px 0;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 600;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider:not(:empty)::before {
    margin-right: .5em;
}

.divider:not(:empty)::after {
    margin-left: .5em;
}

.demo-accounts h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 15px;
    text-align: left;
}

.demo-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-demo-user {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 18px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

.btn-demo-user:hover {
    border-color: var(--logo-green);
    background-color: var(--logo-green-light);
    transform: translateX(4px);
}

.btn-demo-user img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.demo-user-info {
    display: flex;
    flex-direction: column;
}

.demo-user-info strong {
    color: var(--text);
    font-size: 0.95rem;
}

.demo-user-info span {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* User switcher adjustments */
#nav-user-profile {
    display: none; /* Controlled by JS depending on login status */
}

/* Modal form controls */
.modal-content select {
    background-color: var(--surface);
}

.modal-content textarea {
    resize: vertical;
}