/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Authentication Screens */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 2rem;
}

.auth-header p {
    color: #666;
}

.auth-form {
    margin-bottom: 20px;
}

.auth-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* Main App Screen */
#main-screen {
    background: #f8f9fa;
}

.app-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.app-header h1 {
    color: #667eea;
    font-size: 1.8rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.username {
    font-weight: 600;
    color: #333;
}

.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Sections */
.locations-section,
.items-section,
.brought-items-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: #333;
    font-size: 1.5rem;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Locations Grid */
.locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.location-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.location-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.location-card.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.location-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    margin-top: 20px; /* Add space between location ID and name */
}

.location-card p {
    opacity: 0.8;
    font-size: 0.9rem;
}

.location-count {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Items Container */
.items-container,
.brought-items-container {
    min-height: 200px;
}

.item-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    position: relative;
}

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

.item-card.selected {
    border-color: #28a745;
    background: #d4edda;
}

.item-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.item-description {
    flex: 1;
    font-size: 1rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-quantity {
    background: #667eea;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Member Management Styles */
.member-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.member-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-username {
    font-weight: 600;
    color: #333;
}

.member-role {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.member-role.owner {
    background: #28a745;
}

.member-actions {
    display: flex;
    gap: 8px;
}

.btn-remove-member {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-remove-member:hover {
    background: #c82333;
}

.btn-remove-member:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Warning Message */
.warning-message {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.warning-message i {
    color: #856404;
    font-size: 1.2rem;
    margin-top: 2px;
}

.warning-message p {
    margin: 0;
    color: #856404;
    line-height: 1.4;
}

/* Danger Button */
.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.btn-danger:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Interactive Logout Button */
.logout-btn-interactive {
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    padding: 8px 12px;
    min-width: auto;
    width: auto;
}

.logout-btn-interactive .logout-text {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    white-space: nowrap;
    width: 0;
    overflow: hidden;
}

.logout-btn-interactive.expanded .logout-text {
    opacity: 1;
    transform: translateX(0);
    width: auto;
}

.logout-btn-interactive.expanded {
    padding: 8px 16px;
    min-width: 100px;
}

.logout-emoji {
    transition: all 0.3s ease;
    display: inline-block;
}

.logout-btn-interactive.expanded .logout-emoji {
    margin-right: 8px;
}

/* Location Actions */
.location-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-manage-members {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-manage-members:hover {
    background: #138496;
}

.btn-delete-location {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-delete-location:hover {
    background: #c82333;
}

.btn-leave-location {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-leave-location:hover {
    background: #e0a800;
}

.btn-manage-invitations {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-manage-invitations:hover {
    background: #138496;
}

/* Pending Invitations Modal Styles */
.invitations-list {
    max-height: 400px;
    overflow-y: auto;
}

.invitation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.invitation-info h4 {
    margin: 0 0 5px 0;
    color: #495057;
}

.invitation-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.user-not-exists {
    display: inline-block;
    background: #ffc107;
    color: #212529;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-top: 5px;
}

.btn-revoke-invitation {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-revoke-invitation:hover {
    background: #c82333;
}

.no-invitations {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-invitations i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Language Selector Styles */
.language-selector-container {
    position: relative;
    display: inline-block;
    margin: 0 10px;
}

.language-selector {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: space-between;
}

.language-selector:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.language-selector .language-flag {
    font-size: 18px;
    margin-right: 8px;
}

.language-selector .language-name {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    flex: 1;
}

.language-selector .fa-chevron-down {
    font-size: 12px;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.language-selector.active .fa-chevron-down {
    transform: rotate(180deg);
}

.language-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 4px;
    overflow: hidden;
}

.language-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f1f3f4;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: #f8f9fa;
}

.language-option .language-flag {
    font-size: 18px;
    margin-right: 12px;
}

.language-option .language-name {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
}

/* Language selector in auth pages */
.auth-header .header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.auth-header .header-top h1 {
    margin: 0;
}

.auth-header .language-selector-container {
    margin: 0;
}

.auth-header .language-selector {
    min-width: 100px;
    padding: 6px 10px;
}

.auth-header .language-selector .language-name {
    font-size: 12px;
}

/* RTL Support */
[dir="rtl"] .language-selector {
    direction: rtl;
}

[dir="rtl"] .language-selector .language-flag {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .language-option .language-flag {
    margin-right: 0;
    margin-left: 12px;
}

[dir="rtl"] .language-selector .fa-chevron-down {
    transform: scaleX(-1);
}

[dir="rtl"] .language-selector.active .fa-chevron-down {
    transform: scaleX(-1) rotate(180deg);
}

/* Mobile Responsive Language Selector */
@media (max-width: 768px) {
    .language-selector {
        min-width: 100px;
        padding: 6px 8px;
    }
    
    .language-selector .language-name {
        font-size: 12px;
    }
    
    .language-selector .language-flag {
        font-size: 16px;
        margin-right: 6px;
    }
    
    .auth-header .language-selector {
        min-width: 80px;
        padding: 4px 6px;
    }
    
    .auth-header .language-selector .language-name {
        font-size: 10px;
    }
    
    .language-menu {
        min-width: 150px;
    }
    
    .language-option {
        padding: 10px 12px;
    }
    
    .language-option .language-name {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .language-selector-container {
        margin: 0 5px;
    }
    
    .language-selector {
        min-width: 80px;
        padding: 4px 6px;
    }
    
    .language-selector .language-name {
        display: none;
    }
    
    .language-selector .language-flag {
        margin-right: 0;
        font-size: 18px;
    }
    
    .language-menu {
        min-width: 120px;
    }
    
    .language-option .language-name {
        font-size: 12px;
    }
}

/* Pending Invitations Styles */
.pending-invitations-section {
    margin-bottom: 30px;
}

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

.invitation-card {
    background: #f8f9fa;
    border: 2px solid #17a2b8;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.invitation-card:hover {
    border-color: #138496;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.15);
}

.invitation-info {
    flex: 1;
}

.invitation-info h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1.1rem;
}

.invitation-info p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

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

.btn-accept-invitation {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.btn-accept-invitation:hover {
    background: #218838;
}

.btn-decline-invitation {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.btn-decline-invitation:hover {
    background: #c82333;
}

/* App Description Styles */
.app-description {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #007bff;
}

.description-text {
    margin: 0 0 15px 0;
    color: #333;
    line-height: 1.5;
    font-size: 0.95rem;
}

.btn-show-more {
    background: transparent;
    color: #007bff;
    border: 1px solid #007bff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-show-more:hover {
    background: #007bff;
    color: white;
}

.btn-show-more i {
    transition: transform 0.3s ease;
}

.btn-show-more.expanded i {
    transform: rotate(180deg);
}

.expanded-description {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.expanded-description h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1rem;
}

.expanded-description ul {
    margin: 0;
    padding-left: 20px;
    color: #666;
    font-size: 0.9rem;
}

.expanded-description li {
    margin-bottom: 5px;
    line-height: 1.4;
}

/* Enhanced Item Selection Styles */
.item-selector {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.quantity-selector {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.quantity-selector label {
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.bring-quantity,
.undo-quantity {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
}

.quantity-info {
    color: #6c757d;
    font-size: 0.8rem;
}

.item-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.item-card.selected {
    border-color: #667eea;
    background: #f8f9ff;
}

/* Undo Button */
#undo-brought-btn {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#undo-brought-btn:hover:not(:disabled) {
    background: #e0a800;
    transform: translateY(-1px);
}

#undo-brought-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Notification Styles */
.notification-btn {
    position: relative;
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.notification-btn:hover {
    background: #138496;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.notification-badge:empty {
    display: none;
}

.notification-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.notification-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.notification-item.unread {
    background: #f8f9ff;
    border-left: 4px solid #667eea;
}

.notification-user-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.notification-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex: 1;
}

.notification-text {
    flex: 1;
    margin-right: 10px;
}

.notification-time {
    color: #6c757d;
    font-size: 0.8rem;
    white-space: nowrap;
}

.notifications-actions {
    margin-bottom: 15px;
    text-align: right;
}

/* Member Management Styles */
.location-name-section,
.invite-user-section,
.members-section {
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.location-name-section h4,
.invite-user-section h4,
.members-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1rem;
}

.name-edit-form,
.invite-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.name-edit-form input,
.invite-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
}

.name-edit-form button,
.invite-form button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.name-edit-form button:hover,
.invite-form button:hover {
    transform: translateY(-1px);
}

/* Items Bottom Actions */
.items-bottom-actions {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

.items-bottom-actions .btn {
    font-size: 1.1rem;
    padding: 12px 24px;
    font-weight: 500;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #666;
}

.item-user-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #ddd;
}

.brought-item {
    opacity: 0.7;
    background: #e8f5e8;
    border-color: #28a745;
}

.brought-item .item-description {
    text-decoration: line-through;
}

/* No Items Message */
.no-items-message {
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-items-message i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h3 {
    color: #333;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
}

.modal-close:hover {
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
}

.loading-spinner i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 15px;
}

.loading-spinner p {
    color: #666;
    font-size: 1.1rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    .app-header {
        padding: 10px 0;
    }
    
    .app-header h1 {
        font-size: 1.4rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 0 15px;
    }
    
    .user-info {
        gap: 10px;
    }
    
    .join-form {
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
    }
    
    .join-form input {
        width: 100%;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    /* Ensure containers don't overflow */
    .container {
        max-width: 100%;
        overflow-x: hidden;
        padding: 0 10px;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

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

    .items-actions .btn {
        flex: 1;
        justify-content: center;
    }

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

    .form-actions {
        flex-direction: column;
    }

    .modal-content {
        margin: 10px;
        padding: 20px;
    }

    .login-card {
        padding: 30px 20px;
    }

    .app-main {
        padding: 20px 15px;
    }

    .locations-section,
    .items-section,
    .brought-items-section {
        padding: 20px 15px;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 8px 0;
    }
    
    .app-header h1 {
        font-size: 1.2rem;
        margin: 0;
    }
    
    .header-content {
        gap: 8px;
        padding: 0 10px;
    }
    
    .user-info {
        flex-direction: row;
        gap: 8px;
        justify-content: center;
    }
    
    .username {
        font-size: 0.9rem;
    }
    
    .notification-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .logout-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .logout-btn-interactive {
        padding: 6px 8px;
    }
    
    .logout-btn-interactive.expanded {
        padding: 6px 12px;
        min-width: 80px;
    }
    
    .join-form input {
        padding: 8px;
        font-size: 0.9rem;
    }

    .item-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .item-meta {
        width: 100%;
        justify-content: space-between;
    }
}

/* Extra small mobile devices */
@media (max-width: 360px) {
    .app-header {
        padding: 5px 0;
    }
    
    .app-header h1 {
        font-size: 1.1rem;
    }
    
    .header-content {
        gap: 5px;
        padding: 0 8px;
    }
    
    .user-info {
        gap: 5px;
    }
    
    .username {
        font-size: 0.8rem;
    }
    
    .notification-btn, .logout-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    
    .logout-btn-interactive {
        padding: 4px 6px;
    }
    
    .logout-btn-interactive.expanded {
        padding: 4px 10px;
        min-width: 70px;
    }
    
    .user-color {
        width: 16px;
        height: 16px;
    }
    
    .join-form input {
        padding: 6px;
        font-size: 0.8rem;
        letter-spacing: 1px;
    }
}

/* Animation for smooth transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.location-card,
.item-card,
.modal-content {
    animation: fadeIn 0.3s ease;
}

/* Location Actions */
.location-actions-section,
.my-locations-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.action-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.action-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.action-card p {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.join-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.join-form input {
    flex: 1;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
}

.join-form input:focus {
    outline: none;
    border-color: #667eea;
}

/* Location Info */
.location-info-section {
    margin-bottom: 30px;
}

.location-info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.location-info-card h2 {
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.location-info-card p {
    margin-bottom: 8px;
    opacity: 0.9;
}

/* Location ID Display */
.location-id-display {
    text-align: center;
    padding: 20px 0;
}

.location-id-display h4 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.location-id-box {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.location-id-box span {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    letter-spacing: 3px;
    font-family: 'Courier New', monospace;
}

.location-id-help {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

/* Form improvements */
.form-group small {
    color: #666;
    font-size: 0.8rem;
    margin-top: 5px;
    display: block;
}

/* Location cards with ID */
.location-card .location-id {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.location-card .location-members {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

/* Category Management Styles */
.category-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.category-filter {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.category-filter label {
    font-weight: 600;
    color: #495057;
}

.category-filter select {
    flex: 1;
    max-width: 200px;
}

.categories-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.category-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.category-info {
    flex: 1;
}

.category-name {
    font-weight: 600;
    color: #495057;
    display: block;
    margin-bottom: 5px;
}

.category-meta {
    font-size: 0.85em;
    color: #6c757d;
}

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

.no-categories-message {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-categories-message i {
    font-size: 3em;
    margin-bottom: 15px;
    color: #dee2e6;
}

/* Category Requests Styles */
.requests-container {
    max-height: 400px;
    overflow-y: auto;
}

.request-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
}

.request-info h4 {
    color: #495057;
    margin-bottom: 5px;
}

.request-info p {
    color: #6c757d;
    font-size: 0.9em;
    margin: 2px 0;
}

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

.no-requests-message {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-requests-message i {
    font-size: 3em;
    margin-bottom: 15px;
    color: #dee2e6;
}

/* Item Category Display */
.item-category {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    margin-left: 10px;
}

/* Items Category Filter */
.items-category-filter {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.items-category-filter label {
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.items-category-filter select {
    flex: 1;
    max-width: 200px;
}

/* Color Picker Styles */
.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.color-picker {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.color-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.color-preset {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: #333;
}

.color-preset.selected {
    border-color: #333;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #333;
}

/* Category Items with Colors */
.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    position: relative;
}

.category-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 10px 0 0 10px;
    background-color: var(--category-color, #6c757d);
}

.category-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.category-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-name {
    font-weight: 600;
    color: #495057;
    display: block;
    margin-bottom: 5px;
}

.category-meta {
    font-size: 0.85em;
    color: #6c757d;
}

/* Items Filter Dropdown with Colors */
.items-category-filter select option {
    padding: 8px;
}

.category-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-option-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}
