/* Modern Meutch Styling */

/* Root Variables for easy theming */
:root {
    --primary-color: #4fd1c7;        /* Soft teal */
    --primary-dark: #319795;         /* Darker teal */
    --secondary-color: #718096;      /* Muted gray */
    --success-color: #38b2ac;        /* Teal green */
    --warning-color: #f6ad55;        /* Goldenrod */
    --danger-color: #fc8181;         /* Coral */
    --light-bg: #fffffe;             /* Off-white */
    --dark-text: #2d3748;            /* Dark gray */
    --muted-text: #718096;           /* Muted gray */
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px 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);
    --border-radius: 0.5rem;
    --border-radius-sm: 0.25rem;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Base Styles */
body {
    font-family: var(--font-family);
    background-color: var(--light-bg);
    color: var(--dark-text);
    line-height: 1.6;
    padding-top: 70px; /* Account for fixed navbar */
}

/* Custom Bootstrap Variables Override */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    color: white !important;
}

/* Navigation Enhancements */
.navbar {
    backdrop-filter: blur(10px);
    background-color: rgba(248, 250, 252, 0.95) !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--dark-text) !important;
}

.logo-placeholder {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: var(--border-radius-sm);
    color: white;
}

.nav-link {
    font-weight: 500;
    color: var(--dark-text) !important;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

/* Main Content */
.main-content {
    padding: 1rem 0;
}

/* Ensure proper navbar spacing */
.navbar.fixed-top {
    height: auto;
    min-height: 60px;
}

/* Fix about page layout issues */
.main-content .container {
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

@media (min-width: 768px) {
    .main-content .container {
        max-width: 1140px;
        margin: 0 auto;
    }
}

/* Fix About page excessive whitespace */
.main-content .row:first-child {
    margin-top: 0 !important;
}

.main-content .row:first-child.mb-5 {
    margin-bottom: 2rem !important; /* Reduce from default 3rem */
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
    background: white;
    display: flex;
    flex-direction: column;
}

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

.card-img-top {
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.card-body {
    flex: 1;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 0.75rem;
}

.card-text {
    color: var(--muted-text);
    flex: 1;
    margin-bottom: 1rem;
}

.card-footer {
    background: transparent;
    border: none;
    padding: 0 1.25rem 1.25rem;
    margin-top: auto;
}

/* Item Cards Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.item-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

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

/* Circle Cards */
.circles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.circle-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.circle-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--primary-dark);
}

.circle-card h3 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.circle-card p {
    color: var(--muted-text);
    margin-bottom: 1rem;
}

.circle-card a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.circle-card a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
    border: none;
    padding: 0.5rem 1rem;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
    color: white !important;
    border: none !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #2c7a7b) !important;
    transform: translateY(-1px);
    color: white !important;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color) !important;
    color: var(--primary-color) !important;
    background: transparent !important;
}

.btn-outline-primary:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius-sm);
}

.badge.bg-success {
    background-color: var(--success-color) !important;
}

.badge.bg-warning {
    background-color: var(--warning-color) !important;
}

.badge.bg-danger {
    background-color: var(--danger-color) !important;
}

/* Tags and Categories */
.category, .tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    margin: 0.125rem;
    border-radius: 2rem;
    background: var(--light-bg);
    color: var(--muted-text);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

/* Category-specific styling */
.category {
    background: var(--light-bg);
    color: var(--muted-text);
    border-color: var(--border-color);
}

.category:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* Tag-specific styling */
.tag {
    background: rgba(79, 209, 199, 0.1); /* Light teal background using primary color */
    color: var(--primary-dark);
    border-color: var(--primary-color);
}

.tag:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Forms */
.form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: var(--font-family);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.form-label {
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 0.5rem;
}

/* Mobile-friendly file input */
input[type="file"] {
    padding: 0.75rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

input[type="file"]:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f0fdfa 0%, #e6fffa 100%);
    transform: translateY(-1px);
}

input[type="file"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(79, 209, 199, 0.15);
}

/* Mobile specific improvements */
@media (max-width: 768px) {
    input[type="file"] {
        padding: 1rem;
        font-size: 1rem;
        min-height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    input[type="file"]::file-selector-button {
        background: var(--primary-color);
        color: white;
        border: none;
        padding: 0.75rem 1.5rem;
        border-radius: var(--border-radius-sm);
        font-weight: 500;
        margin-right: 1rem;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }
    
    input[type="file"]::file-selector-button:hover {
        background: var(--primary-dark);
    }
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background-color: #f0fdfa;
    color: #234e52;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: #fff5f5;
    color: #c53030;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background-color: #fffaf0;
    color: #c05621;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background-color: #f0fdfa;
    color: #2c7a7b;
    border-left: 4px solid var(--primary-color);
}

/* Search Results */
.search-card {
    max-width: none;
    margin: 0;
}

.item-thumbnail {
    height: 180px;
    object-fit: cover;
    width: 100%;
    border-radius: var(--border-radius-sm);
}

/* Profile Images */
.profile-picture-small {
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

/* Sections */
.user-circles, .items-section {
    margin-bottom: 3rem;
}

.user-circles h2, .items-section h2 {
    color: var(--dark-text);
    font-weight: 600;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

/* Footer */
footer {
    background: white !important;
    border-top: 1px solid var(--border-color) !important;
    margin-top: auto;
}

footer h6 {
    color: var(--primary-color) !important;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted-text);
}

.empty-state i {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .items-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .circles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .circle-card {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    body {
        padding-top: 70px;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .container {
        padding: 0 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators for keyboard navigation */
.btn:focus,
.nav-link:focus,
.form-control:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --muted-text: #000;
    }
}

/* Print styles */
@media print {
    .navbar,
    footer,
    .btn {
        display: none !important;
    }
    
    .main-content {
        padding-top: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Optional: Change cursor to pointer for clickable cards */
.item-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.item-card:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Optional: Ensure images don't have default link styles */
.item-link img {
    display: block; /* Removes bottom margin/padding */
    color: inherit; /* Inherit text color */
}

/* Ensure inner text doesn't get extra styles from <a> */
.item-link .card-title,
.item-link .card-text {
    color: inherit;
}

/* Ensure the 'My Items' edit and delete buttons are styled correctly */
.card-footer a.btn {
    margin-right: 5px;
    text-decoration: none; /* Remove underlines from buttons */
}

/* Optional: Prevent links inside the card footer from affecting the parent link */
.card-footer a,
.card-footer form {
    pointer-events: auto;
}

/* Remove pointer events from the parent link when interacting with footer elements */
.card-footer {
    position: relative;
}

/* Ensure that the footer buttons are clickable without triggering the parent link */
.card-footer a.btn,
.card-footer form {
    position: relative;
    z-index: 2;
}
/* Ensure text colors are readable */
.card-title.text-primary {
    color: #007bff !important;
}

.card-text.text-dark {
    color: #212529 !important;
}

.profile-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #ddd; /* Optional: Add a border for better appearance */
}

.profile-picture-link {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000; /* Ensures the profile picture stays above other elements */
}

.profile-picture-small {
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff; /* Optional: Adds a white border around the image */
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); /* Optional: Adds a subtle shadow for depth */
    cursor: pointer;
}

.faq-section {
    margin-top: 20px;
}

.faq-item {
    margin-bottom: 20px;
}

.faq-item h4 {
    color: #0d6efd; /* Bootstrap primary color */
}

.faq-item p {
    margin-left: 20px;
    color: #555;
}

.item-image {
    max-width: 400px; /* Adjust the value as needed */
    width: 100%;
    height: auto;
    object-fit: contain;
    border: 2px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.item-image-placeholder {
    max-width: 400px;
    width: 100%;
    height: 250px;
    border: 2px dashed var(--border-color);
    border-radius: 5px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

/* Item Detail Page Styles */
.item-detail-image-container {
    position: sticky;
    top: 100px;
}

.item-detail-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.item-detail-image-placeholder {
    width: 100%;
    height: 400px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    transition: all 0.3s ease;
}

.item-detail-image-placeholder:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f0fdfa 0%, #e6fffa 100%);
}

.item-detail-content .card {
    border: none;
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.item-detail-content .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.item-detail-content .card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    border: none;
}

.item-detail-content .card-title {
    color: var(--dark-text);
    font-weight: 700;
    margin-bottom: 0;
}

.item-detail-content .card-header .card-title {
    color: white;
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .item-detail-image-container {
        position: static;
        margin-bottom: 2rem;
    }
    
    .item-detail-image {
        max-height: 300px;
    }
    
    .item-detail-image-placeholder {
        height: 300px;
    }
}

.unread-conversation {
    background-color: #fff3cd; /* Light yellow background */
    font-weight: bold;          /* Bold text */
    border-left: 5px solid #ffc107; /* Yellow left border */
    transition: background-color 0.3s, border-left 0.3s; /* Smooth transition */
}

.unread-conversation:hover {
    background-color: #ffeeba; /* Slightly darker yellow on hover */
}

/* Style for the combined conversation link */
.conversation-link {
    color: #0d6efd; /* Bootstrap primary blue */
    font-size: 1rem; /* Normal text size */
}

.conversation-header.card {
    max-width: none;  /* Override the default card max-width */
    width: 100%;      /* Allow it to expand full width */
}

.conversation-header h2 {
    white-space: nowrap;  /* Prevent text wrapping */
    overflow: hidden;     /* In case of very long names/titles */
    text-overflow: ellipsis;  /* Show ... if text overflows */
}


/* Truncate long message snippets gracefully */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Ensure the container has proper spacing */
.container.mt-5 {
    margin-top: 3rem !important;
}

.other-user {
    font-weight: bold;
    color: #ff8c00;
}

/* Make the item name italic and a different color */
.item-name {
    font-style: italic;
    color: #28a745; /* Bootstrap success color or choose another */
}

.button-group {
    display: flex;
    gap: 5px; /* Adjust spacing as needed */
}

/* Form Controls */
.form-control {
    width: 100%;                 /* Occupies full width of the parent container */
    padding: 8px;                /* Adds padding inside the textbox */
    border: 1px solid #ccc;      /* Defines a light gray border */
    border-radius: 4px;          /* Rounds the corners of the textbox */
    box-sizing: border-box;      /* Ensures padding and border are included in the total width */
    resize: vertical;            /* Allows users to resize the textbox vertically */
    font-size: 14px;             /* Sets a comfortable font size */
    font-family: Arial, sans-serif; /* Defines a clean font */
}

/* Optional: Focus State for Better UX */
.form-control:focus {
    border-color: #80bdff;       /* Changes border color on focus */
    outline: none;               /* Removes the default outline */
    box-shadow: 0 0 5px rgba(128, 189, 255, 0.5); /* Adds a subtle shadow */
}

/* Smaller Form Control for Datepickers */
.form-control-small {
    width: 150px; /* Adjust the width as needed */
}

/* Flex Layout for Form Rows */
.form-row {
    display: flex;
    gap: 20px; /* Space between the columns */
    align-items: flex-start; /* Align items to the top */
    margin-bottom: 15px; /* Space below the row */
}

.message-card {
    max-width: 80%;
    margin-bottom: 1rem;
    transition: transform 0.1s ease-in-out;
}

.message-mine, .message-theirs {
    /* Remove margin-left and margin-right */
    margin-left: 0;
    margin-right: 0;
    max-width: 80%; /* Optional: Adjust the width as needed */
    /* Ensure consistent padding */
    padding: 10px;
    border-radius: 5px; /* Rounded corners for better aesthetics */
}

/* Styles for messages sent by the current user */
.message-mine {
    background-color: #e3f2fd; /* Light blue */
    border-left: 4px solid #1976d2; /* Blue border */
    margin-left: 40px; /* Indent slightly from the left */
}

/* Styles for messages sent by others */
.message-theirs {
    background-color: #f5f5f5; /* Light grey */
    border-left: 4px solid #757575; /* Grey border */
    /* No indentation for others' messages */
}

/* Styles for loan-related messages */
.message-loan {
    border-left: 4px solid #ffc107; /* Amber border */
    background-color: #fff8e1; /* Light amber background */
}

.message-loan .card-header {
    background-color: #fff8e1;
    border-bottom: 1px solid #ffe082;
}

.message-loan .loan-request-details {
    background-color: #fff3cd; /* Light yellow background */
    border: 1px solid #ffeeba;
    padding: 10px;
    border-radius: 5px;
}

/* Optional: Add an icon to loan-related messages */
.message-loan::before {
    content: "📋"; /* Clipboard icon */
    margin-right: 8px;
    font-size: 1.2em;
    /* Ensure the icon doesn't disrupt the layout */
    display: inline-block;
    vertical-align: middle;
}

/* Optional: Different text color for loan-related messages */
.message-loan p {
    color: #856404; /* Dark yellow */
}

/* Timestamp styling */
.message-timestamp {
    font-size: 0.8em;
    color: #666;
}

/* Thread container spacing */
.thread-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0;
}

/* Unread message indicator */
.unread-message {
    border-bottom: 2px solid #dc3545; /* Red bottom border for unread messages */
}

/* Additional styles for better distinction */
.message-loan.message-mine {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    margin-left: 40px; /* Maintain indentation */
}

.message-loan.message-theirs {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

/* Optional: Hover effects for loan-related messages */
.message-loan:hover {
    background-color: #ffeeba; /* Slightly darker amber on hover */
}

/* Ensure icons are properly aligned */
.message-loan .card-header::before,
.message-loan .card-body::before {
    content: "";
    display: none; /* Remove if not needed */
}

/* Optional: Improve readability by adding padding */
.message-card .card-body p {
    margin-bottom: 0;
}

/* Optional: Adjust overall message card styles for better appearance */
.message-card {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
}

/* Thumbnail styling */
.thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

/* Table styling */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    color: #212529;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
    text-align: left;
}

.table th {
    background-color: #f8f9fa;
}

.table tr:hover {
    background-color: #f1f1f1;
}

/* Button adjustments */
.btn-info {
    background-color: #17a2b8;
    color: white;
    text-decoration: none;
}

.btn-info:hover {
    background-color: #138496;
    color: white;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
}