/* css/dashboard.css - Modern Dashboard Styling */

:root {
    --primary-color: #8b0000;
    --primary-hover: #6b0000;
    --primary-light: #fff5f5;
    --text-dark: #1f2937;
    --text-medium: #4b5563;
    --text-light: #9ca3af;
    --bg-light: #f3f4f6;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Navbar overrides */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
    height: 70px;
}

.nav-container {
    max-width: 1400px;
    height: 100%;
}

/* Dashboard Layout */
.dashboard-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: calc(100vh - 70px);
    background-color: var(--bg-light);
}

/* Sidebar Styling */
.dashboard-sidebar {
    background: var(--white);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    height: calc(100vh - 70px);
    position: sticky;
    top: 70px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.user-info {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.user-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 1rem;
    border: 4px solid var(--white);
    box-shadow: var(--shadow-md);
}

.user-info h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.user-info p {
    font-size: 0.875rem;
    color: var(--text-medium);
}

.dashboard-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-medium);
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
}

.menu-item:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
    transform: translateX(4px);
}

.menu-item.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
}

.menu-item i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

/* Main Content Area */
.dashboard-content {
    padding: 2.5rem;
    max-width: 1200px;
    margin: 0;
    width: 100%;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

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

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

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.dashboard-header h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.dashboard-header h2 i {
    color: var(--primary-color);
}

/* Buttons & Filters */
.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(139, 0, 0, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(139, 0, 0, 0.3);
}

.ads-filters {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.ads-filters select {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--white);
    color: var(--text-dark);
    font-size: 0.95rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    min-width: 200px;
}

.ads-filters select:hover {
    border-color: var(--primary-color);
}

.ads-filters select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

/* Logout Button Size Fix */
#logout-btn {
    padding: 10px 16px;
    font-weight: 500;
}

@media (min-width: 1024px) {
    #logout-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* My Ads Grid & Cards */
.my-ads-grid, .favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.my-ad-card, .favorite-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.my-ad-card:hover, .favorite-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.my-ad-image {
    height: 160px;
    position: relative;
    overflow: hidden;
    background: #f0f2f5;
}

.my-ad-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.my-ad-card:hover .my-ad-image img {
    transform: scale(1.05);
}

.ad-status {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.ad-status.active {
    background: rgba(16, 185, 129, 0.9);
}

.ad-status.inactive {
    background: rgba(239, 68, 68, 0.9);
}

.my-ad-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.my-ad-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-ad-price {
    font-size: 18px;
    font-weight: 700;
    color: #8b0000;
    margin-bottom: 12px;
}

.ad-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f3f4f6;
}

.ad-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ad-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.ad-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.ad-action-btn.edit {
    background: #f3f4f6;
    color: #4b5563;
}

.ad-action-btn.edit:hover {
    background: #e5e7eb;
    color: #1f2937;
    border-color: #d1d5db;
}

.ad-action-btn.delete {
    background: #fff1f2;
    color: #e11d48;
}

.ad-action-btn.delete:hover {
    background: #ffe4e6;
    border-color: #fda4af;
}

/* Empty States */
.no-ads, .no-favorites, .no-messages {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    border: 2px dashed #e5e7eb;
    color: #6b7280;
    margin-top: 20px;
    display: none; /* Controlled by JS */
}

.no-ads i, .no-favorites i, .no-messages i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #d1d5db;
}

.no-ads h3, .no-favorites h3, .no-messages h3 {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.no-ads p, .no-favorites p, .no-messages p {
    margin-bottom: 24px;
}

/* Messages List */
.chats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Chat Items */
.chat-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    align-items: center;
    gap: 12px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.chat-thumb {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-header-info {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    align-items: center;
}

.chat-user {
    font-weight: 600;
    color: var(--text-dark);
}

.chat-ad-title {
    grid-column: 1 / -1;
    font-size: 0.95rem;
    color: var(--text-medium);
}

.chat-time {
    font-size: 0.85rem;
    color: var(--text-light);
}

.chat-preview {
    font-size: 0.95rem;
    color: var(--text-medium);
}

.chat-unread {
    background: #ef4444;
    color: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Settings Form */
.settings-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .my-ads-grid, .favorites-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0 10px;
    }
    .my-ad-image {
        height: auto;
        aspect-ratio: 4/3;
    }
    .my-ad-title {
        font-size: 14px;
    }
    .my-ad-price {
        font-size: 16px;
    }
    .ad-meta {
        font-size: 11px;
    }
    .ad-action-btn {
        padding: 6px 8px;
        font-size: 12px;
    }
}

.form-section {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #f3f4f6;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #8b0000;
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.avatar-upload-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #ddd;
    color: #aaa;
    font-size: 24px;
}

.file-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.file-input {
    display: none;
}

.file-upload-btn {
    background: var(--white);
    color: var(--text-dark);
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-btn:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.file-upload-name {
    font-size: 0.9rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-secondary {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Password Toggle Styling */
.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-container input {
    padding-right: 40px; /* Make space for the icon */
}

.toggle-password {
    position: absolute;
    right: 12px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.toggle-password:hover {
    color: #8b0000;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        height: auto;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 1.5rem;
    }

    .dashboard-content {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .my-ads-grid, .favorites-grid {
        grid-template-columns: 1fr;
    }
    
    .ad-actions {
        flex-direction: row; /* Keep buttons in row on mobile too */
    }
    
    /* Mobile model for Settings */
    .settings-form {
        padding: 1.25rem;
        border-radius: 10px;
    }
    .form-section {
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }
    .form-group {
        margin-bottom: 1.25rem;
    }
    .avatar-upload-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .avatar-preview {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
    .file-upload {
        width: 100%;
        gap: 8px;
        flex-wrap: wrap;
    }
    .file-upload-btn {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
    .file-upload-name {
        max-width: 100%;
        font-size: 0.85rem;
    }
    .form-row {
        display: flex;
        flex-direction: column !important;
        gap: 12px !important;
    }
    .form-row .form-group {
        flex: 1;
    }
    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    .form-actions .btn-secondary,
    .form-actions .btn-primary {
        width: 100%;
        justify-content: center;
    }
}
