/* ============================================================
   Client Dashboard Styles
   Fully compatible with style.css variables & dark mode
   ============================================================ */

/* ------------------------------------------------------------
   Dashboard Layout & Welcome
   ------------------------------------------------------------ */
.cd-welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 60%, var(--warn)) 100%);
    color: #fff;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease;
}

.cd-welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.cd-welcome-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

.cd-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.4);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.cd-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 3px solid rgba(255,255,255,0.4);
    flex-shrink: 0;
}

.cd-welcome-text h2 {
    margin: 0 0 0.25rem;
    font-size: 1.75rem;
    font-weight: 800;
}

.cd-welcome-text p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

/* ------------------------------------------------------------
   Stats Grid
   ------------------------------------------------------------ */
.cd-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.cd-stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.75rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: scaleIn 0.5s ease;
}

.cd-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(38, 116, 69, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.cd-stat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: rgba(38, 116, 69, 0.25);
}

.cd-stat-icon {
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
    display: block;
}

.cd-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 0.25rem;
    line-height: 1;
}

.cd-stat-label {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

/* ------------------------------------------------------------
   Quick Actions Grid
   ------------------------------------------------------------ */
.cd-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.cd-action-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 1rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    animation: scaleIn 0.5s ease;
}

.cd-action-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    color: var(--primary);
}

.cd-action-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(38, 116, 69, 0.08);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cd-action-card:hover .cd-action-icon {
    background: var(--primary);
    transform: scale(1.1);
}

.cd-action-card:hover .cd-action-icon {
    color: #fff;
}

.cd-action-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0;
}

.cd-action-desc {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.4;
}

/* ------------------------------------------------------------
   Content Sections
   ------------------------------------------------------------ */
.cd-section {
    margin-bottom: 2.5rem;
    animation: fadeInUp 0.6s ease;
}

.cd-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.cd-section-header h3 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cd-section-header a {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    transition: opacity 0.2s;
}

.cd-section-header a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ------------------------------------------------------------
   Ads Grid (Dashboard Preview)
   ------------------------------------------------------------ */
.cd-ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.cd-ad-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.4s ease;
}

.cd-ad-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: rgba(38, 116, 69, 0.3);
}

.cd-ad-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--card) 0%, rgba(38, 116, 69, 0.05) 100%);
    transition: transform 0.3s ease;
}

.cd-ad-card:hover .cd-ad-image {
    transform: scale(1.05);
}

.cd-ad-image-placeholder {
    width: 100%;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--card) 0%, rgba(38, 116, 69, 0.05) 100%);
}

.cd-ad-body {
    padding: 1rem 1.25rem 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cd-ad-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cd-ad-price {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 0.75rem;
}

.cd-ad-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cd-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.cd-status.pending {
    background: rgba(249, 177, 34, 0.15);
    color: #b07d12;
}

.cd-status.active {
    background: rgba(38, 116, 69, 0.12);
    color: var(--primary);
}

.cd-status.sold {
    background: rgba(54, 162, 235, 0.12);
    color: #2b6cb0;
}

.cd-status.expired {
    background: rgba(160, 160, 160, 0.15);
    color: var(--muted);
}

[data-theme="dark"] .cd-status.pending {
    background: rgba(249, 177, 34, 0.2);
    color: #f9b122;
}

[data-theme="dark"] .cd-status.active {
    background: rgba(249, 177, 34, 0.15);
    color: var(--primary);
}

/* ------------------------------------------------------------
   Appointments List & Cards
   ------------------------------------------------------------ */
.cd-appointment-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.cd-appointment-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: scaleIn 0.4s ease;
}

.cd-appointment-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.cd-appointment-header {
    background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 70%, var(--warn)) 100%);
    color: #fff;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.cd-appointment-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.cd-appointment-body {
    padding: 1.25rem 1.5rem;
}

.cd-appointment-body p {
    margin: 0.6rem 0;
    color: var(--text);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cd-appointment-body strong {
    color: var(--muted);
    font-weight: 600;
    min-width: 80px;
}

.cd-badge {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}

.cd-badge.pending {
    background: rgba(249, 177, 34, 0.15);
    color: #b07d12;
}

.cd-badge.confirmed {
    background: rgba(38, 116, 69, 0.12);
    color: var(--primary);
}

.cd-badge.completed {
    background: rgba(54, 162, 235, 0.12);
    color: #2b6cb0;
}

.cd-badge.canceled {
    background: rgba(220, 53, 69, 0.12);
    color: #c82333;
}

[data-theme="dark"] .cd-badge.pending {
    background: rgba(249, 177, 34, 0.2);
    color: #f9b122;
}

[data-theme="dark"] .cd-badge.confirmed {
    background: rgba(249, 177, 34, 0.15);
    color: var(--primary);
}

/* ------------------------------------------------------------
   Empty State
   ------------------------------------------------------------ */
.cd-empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--card);
    border: 2px dashed var(--border);
    border-radius: 1rem;
    color: var(--muted);
    animation: fadeInUp 0.5s ease;
}

.cd-empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    opacity: 0.5;
}

.cd-empty-state p {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

/* ------------------------------------------------------------
   Profile Page Styles
   ------------------------------------------------------------ */
.cd-profile-container {
    max-width: 900px;
    margin: 2rem auto;
    animation: fadeInUp 0.5s ease;
}

.cd-profile-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.cd-profile-header h1 {
    color: var(--primary);
    font-size: 1.75rem;
    margin: 0 0 0.5rem;
}

.cd-profile-header p {
    color: var(--muted);
    margin: 0;
}

.cd-profile-pic-container {
    text-align: center;
    padding: 1.5rem 0;
}

.cd-profile-pic-img,
.cd-profile-pic-placeholder {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    border: 4px solid var(--primary);
    display: block;
    box-shadow: var(--shadow-md);
}

.cd-profile-pic-placeholder {
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: var(--primary);
    border: 4px solid var(--border);
}

/* Tabs */
.cd-profile-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}

.cd-tab-btn {
    background: none;
    border: none;
    padding: 0.85rem 1.25rem;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 0.5rem 0.5rem 0 0;
    transition: all 0.3s ease;
    color: var(--muted);
    font-family: inherit;
    font-weight: 600;
    position: relative;
}

.cd-tab-btn.active {
    color: var(--primary);
    font-weight: 700;
}

.cd-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

.cd-tab-btn:hover {
    color: var(--primary);
    background: rgba(38, 116, 69, 0.04);
}

.cd-tab-content {
    display: none;
}

.cd-tab-content.active {
    display: block;
    animation: fadeInUp 0.4s ease;
}

/* Profile Forms */
.cd-form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.cd-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.cd-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cd-form-group.full {
    grid-column: 1 / -1;
}

.cd-form-group label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.cd-form-group input,
.cd-form-group select,
.cd-form-group textarea {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    transition: all 0.3s ease;
}

.cd-form-group input:focus,
.cd-form-group select:focus,
.cd-form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(38, 116, 69, 0.08);
}

.cd-form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.cd-form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.cd-document-preview {
    margin-top: 0.5rem;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border);
    max-width: 200px;
}

.cd-document-preview img {
    width: 100%;
    display: block;
}

.cd-document-status {
    padding: 1rem 1.25rem;
    background: rgba(38, 116, 69, 0.08);
    border: 1px solid rgba(38, 116, 69, 0.2);
    border-radius: 0.75rem;
    margin-bottom: 1.25rem;
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cd-logout-section {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.cd-logout-link {
    color: #dc3545;
    text-decoration: none;
    font-weight: 700;
    transition: opacity 0.2s;
    font-size: 1rem;
}

.cd-logout-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ------------------------------------------------------------
   Legacy compatibility / preserved selectors
   ------------------------------------------------------------ */
.stats-grid, .action-grid, .ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 60%, var(--warn)) 100%);
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
}

.stat-card h3 {
    font-size: 2.5rem;
    margin: 0;
}

.action-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.ad-card {
    background: var(--card);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.ad-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.status {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status.active {
    background: rgba(38, 116, 69, 0.12);
    color: var(--primary);
}

.status.pending {
    background: rgba(249, 177, 34, 0.15);
    color: #b07d12;
}

.no-data {
    text-align: center;
    padding: 3rem;
    background: var(--card);
    border-radius: 1rem;
    font-size: 1.1rem;
    color: var(--muted);
    border: 2px dashed var(--border);
}

.profile-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
}

.profile-header {
    text-align: center;
    margin-bottom: 40px;
}

.profile-header h1 {
    color: var(--primary);
    font-size: 32px;
    margin-bottom: 10px;
}

.profile-header p {
    color: var(--muted);
}

.profile-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 16px;
    border-radius: 6px 6px 0 0;
    transition: all 0.3s;
    color: inherit;
}

.tab-btn.active {
    border-bottom: 3px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.profile-pic-container {
    text-align: center;
    padding: 40px 0;
}

.profile-pic-img,
.profile-pic-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 20px;
    border: 3px solid var(--primary);
    display: block;
}

.profile-pic-placeholder {
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    color: var(--primary);
}

.document-status {
    padding: 15px;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-radius: 8px;
    margin-bottom: 20px;
}

.logout-section {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.logout-link {
    color: #dc3545;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.logout-link:hover {
    opacity: 0.8;
}

.password-hint {
    font-size: 14px;
    color: var(--muted);
    margin-top: 5px;
    font-style: italic;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
}

/* ------------------------------------------------------------
   Responsive Adjustments
   ------------------------------------------------------------ */
@media (max-width: 768px) {
    .cd-welcome-inner {
        flex-direction: column;
        text-align: center;
    }

    .cd-stats-grid,
    .cd-actions-grid {
        grid-template-columns: 1fr;
    }

    .cd-ads-grid {
        grid-template-columns: 1fr;
    }

    .cd-appointment-list {
        grid-template-columns: 1fr;
    }

    .cd-section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .cd-profile-tabs {
        flex-direction: column;
        gap: 0;
        border-bottom: none;
    }

    .cd-tab-btn {
        border-radius: 0.5rem;
        width: 100%;
        text-align: center;
        border-bottom: 2px solid transparent;
    }

    .cd-tab-btn.active::after {
        display: none;
    }

    .cd-tab-btn.active {
        border-bottom-color: var(--primary);
        background: rgba(38, 116, 69, 0.06);
    }

    .cd-form-grid {
        grid-template-columns: 1fr;
    }

    .cd-form-actions {
        justify-content: center;
    }

    .stats-grid, .action-grid, .ads-grid {
        grid-template-columns: 1fr;
    }

    .profile-tabs {
        flex-direction: column;
        gap: 5px;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }
}

