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

:root {
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --secondary-color: #4CAF50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --sidebar-width: 260px;
    --header-height: 60px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Auth Container */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    padding: 20px;
}

.auth-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

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

.logo-icons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}

.logo-icons i {
    font-size: 32px;
    color: var(--primary-color);
}

.logo-icons i:nth-child(2) {
    color: var(--secondary-color);
}

.logo-icons i:nth-child(3) {
    color: var(--danger-color);
}

.logo h1 {
    font-size: 28px;
    color: var(--text-color);
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-color);
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-color);
}

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

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

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

.btn-icon {
    padding: 8px;
    background: none;
    color: var(--text-muted);
}

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

/* Auth Switch Link */
.auth-switch {
    text-align: center;
    margin-top: 16px;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
}

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

/* Main App Layout */
.main-app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo-icons {
    gap: 6px;
}

.sidebar-header .logo-icons i {
    font-size: 22px;
}

.sidebar-header span {
    font-size: 20px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    gap: 12px;
    position: relative;
    transition: background-color 0.2s;
}

.nav-item:hover {
    background-color: var(--bg-color);
}

.nav-item.active {
    background-color: rgba(33, 150, 243, 0.1);
    color: var(--primary-color);
}

.nav-item i {
    width: 24px;
    text-align: center;
}

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

.badge.hidden {
    display: none;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info span {
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--primary-color);
}

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

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

.location-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

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

.location-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.location-info {
    padding: 16px;
}

.location-info h4 {
    margin-bottom: 8px;
    font-size: 16px;
}

.location-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 13px;
}

.location-privacy {
    display: flex;
    align-items: center;
    gap: 4px;
}

.location-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.location-author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* Friends */
.friends-section {
    margin-bottom: 32px;
}

.friends-section h3 {
    margin-bottom: 16px;
    color: var(--text-muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.friends-list {
    display: grid;
    gap: 12px;
}

.friend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.friend-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.friend-info img,
.friend-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
}

.friend-info div h4 {
    font-size: 15px;
    margin-bottom: 2px;
}

.friend-info div span {
    font-size: 13px;
    color: var(--text-muted);
}

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

/* Conversations */
.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.conversation-item:hover {
    background-color: var(--bg-color);
}

.conversation-item.unread {
    background-color: rgba(33, 150, 243, 0.05);
}

.conversation-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 20px;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-info h4 {
    font-size: 15px;
    margin-bottom: 4px;
}

.conversation-info p {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-meta {
    text-align: right;
}

.conversation-meta time {
    font-size: 12px;
    color: var(--text-muted);
}

.conversation-meta .unread-count {
    background-color: var(--primary-color);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
    display: inline-block;
}

/* Upload Form */
.upload-form {
    max-width: 600px;
    background: var(--card-bg);
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.photo-preview {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    margin-top: 12px;
    border-radius: 8px;
}

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-modal-content {
    max-width: 600px;
    height: 80vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Chat */
.chat-header-info {
    display: flex;
    flex-direction: column;
}

.chat-header-info span:first-child {
    font-weight: 600;
}

.typing-indicator {
    font-size: 12px;
    color: var(--primary-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
}

.message.sent {
    align-self: flex-end;
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background-color: var(--bg-color);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.chat-input-area {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Search Results */
.search-results {
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

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

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

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.toast.success {
    background-color: var(--secondary-color);
}

.toast.error {
    background-color: var(--danger-color);
}

.toast.info {
    background-color: var(--primary-color);
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Admin Panel */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.admin-stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.admin-stat-card i {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.admin-stat-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
}

.admin-stat-label {
    display: block;
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.admin-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.admin-section h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.admin-table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

.admin-table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.admin-table tbody tr:hover {
    background-color: var(--bg-color);
}

.admin-role-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.admin-role-badge.admin {
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--danger-color);
}

.admin-role-badge.user {
    background-color: rgba(33, 150, 243, 0.1);
    color: var(--primary-color);
}

.admin-pagination {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}

.admin-pagination .btn {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 13px;
}

/* Sidebar Info */
.sidebar-info {
    display: flex;
    justify-content: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.sidebar-info .btn-icon {
    font-size: 18px;
    color: var(--text-muted);
}

.sidebar-info .btn-icon:hover {
    color: var(--primary-color);
}

/* Info Modal */
.info-modal-content {
    max-width: 480px;
}

.info-modal-body {
    padding: 20px;
}

.info-section {
    margin-bottom: 20px;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section h4 i {
    color: var(--primary-color);
}

.info-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-features li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.info-features li i {
    color: var(--primary-color);
    width: 20px;
    text-align: center;
    margin-top: 2px;
}

.info-download-btn {
    margin-top: 12px;
    width: 100%;
}

.info-credits {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.info-credits p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.info-credits a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.info-credits a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-header span,
    .nav-item span,
    .user-info span {
        display: none;
    }

    .main-content {
        margin-left: 60px;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .filter-tabs {
        flex-wrap: wrap;
    }

    .admin-stats-grid {
        grid-template-columns: 1fr;
    }
}
