/**
 * Dashboard Styles
 * Main dashboard view with sidebar navigation and projects grid
 */

/* Dashboard Container */
#dashboardView {
    display: flex;
    height: 100vh;
    width: 100%;
    background: #121212;
    overflow: hidden;
}

#editorView {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #121212;
    z-index: 10;
}

/* Dashboard Sidebar - Material Design */
.dashboard-sidebar {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    background: rgba(30,30,30,0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--md-divider);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    /* Material Design elevation dp4 */
    box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.2),
                0px 4px 5px 0px rgba(0,0,0,0.14),
                0px 1px 10px 0px rgba(0,0,0,0.12);
}

.dashboard-header {
    padding: 24px 20px 20px 20px;
    background: var(--md-surface-1);
    border-bottom: 1px solid var(--md-divider);
}

.dashboard-header h1 {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: #ffffff;
}

/* User Profile Section */
.dashboard-user-profile {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.dashboard-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
    align-self: center;
}

.dashboard-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    text-align: center;
}

.dashboard-name {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-email {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-logout-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    color: rgba(255,255,255,0.7);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
}

.dashboard-logout-btn .material-icons {
    font-size: 18px;
}

.dashboard-logout-btn:hover {
    background: rgba(255, 59, 48, 0.1);
    border-color: rgba(255, 59, 48, 0.3);
    color: #ff3b30;
}

/* Navigation Menu */
.dashboard-nav {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--md-text-medium);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 280ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.dashboard-nav-item:not(:disabled):hover {
    background: var(--md-surface-2);
    color: var(--md-text-high);
}

.dashboard-nav-item.active {
    background: var(--md-surface-3);
    color: var(--md-primary);
}

.dashboard-nav-item:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.dashboard-nav-item svg {
    flex-shrink: 0;
}

.dashboard-nav-item span:first-of-type {
    flex: 1;
    text-align: left;
}

.coming-soon-badge {
    font-size: 10px;
    font-weight: 600;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard Content */
.dashboard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
}

.dashboard-content-header {
    padding: 24px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.dashboard-content-header h2 {
    font-size: 24px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--md-text-high);
    margin: 0;
}

.add-content-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--md-primary);
    color: #000000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.25px;
    transition: background-color 280ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);
    /* Material Design elevation dp2 */
    box-shadow: 0px 3px 1px -2px rgba(0,0,0,0.2),
                0px 2px 2px 0px rgba(0,0,0,0.14),
                0px 1px 5px 0px rgba(0,0,0,0.12);
}

.add-content-btn:hover {
    background: var(--md-primary-dark);
    /* Material Design elevation dp4 */
    box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.2),
                0px 4px 5px 0px rgba(0,0,0,0.14),
                0px 1px 10px 0px rgba(0,0,0,0.12);
}

.add-content-btn:active {
    /* Material Design elevation dp8 */
    box-shadow: 0px 5px 5px -3px rgba(0,0,0,0.2),
                0px 8px 10px 1px rgba(0,0,0,0.14),
                0px 3px 14px 2px rgba(0,0,0,0.12);
}

/* Projects Grid */
.dashboard-projects-grid {
    flex: 1;
    padding: 24px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-content: start;
    box-sizing: border-box;
    width: 100%;
}

@media (max-width: 1400px) {
    .dashboard-projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 900px) {
    .dashboard-projects-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 20px;
    }
    .dashboard-sidebar {
        width: 220px;
        min-width: 220px;
        max-width: 220px;
    }
}

.dashboard-projects-grid::-webkit-scrollbar {
    width: 6px;
}

.dashboard-projects-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* Project Card - Material Design */
.project-card {
    background: rgba(30,30,30,0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--md-divider);
    border-radius: 16px;
    overflow: hidden;
    transition: box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1),
                transform 280ms cubic-bezier(0.4, 0, 0.2, 1),
                border-color 280ms cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 320px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    /* Material Design elevation dp8 */
    box-shadow: 0px 5px 5px -3px rgba(0,0,0,0.2),
                0px 8px 10px 1px rgba(0,0,0,0.14),
                0px 3px 14px 2px rgba(0,0,0,0.12);
}

/* Status Badges */
.project-status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.project-status-badge.draft {
    background: rgba(158, 158, 158, 0.25);
    color: #000000;
    border: 1px solid rgba(158, 158, 158, 0.4);
}

.project-status-badge.published {
    background: rgba(52, 168, 83, 0.2);
    color: var(--md-success);
    border: 1px solid rgba(52, 168, 83, 0.3);
}

.project-status-badge.both {
    background: linear-gradient(90deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.12) 50%, rgba(52, 168, 83, 0.2) 50%, rgba(52, 168, 83, 0.2) 100%);
    color: var(--md-text-high);
}

.project-status-badge.campaign {
    background: rgba(98, 0, 234, 0.2);
    color: var(--md-secondary);
    border: 1px solid rgba(98, 0, 234, 0.3);
}

.project-status-badge.campaign-draft {
    background: rgba(98, 0, 234, 0.15);
    color: rgba(187, 134, 252, 0.9);
    border: 1px solid rgba(98, 0, 234, 0.25);
}

.project-status-badge.converted {
    background: rgba(66, 133, 244, 0.2);
    color: #4285f4;
    border: 1px solid rgba(66, 133, 244, 0.4);
}

.project-status-badge.email {
    background: rgba(234, 67, 53, 0.2);
    color: #ea4335;
    border: 1px solid rgba(234, 67, 53, 0.3);
}

.project-status-badge.email-draft {
    background: rgba(234, 67, 53, 0.15);
    color: rgba(244, 143, 177, 0.9);
    border: 1px solid rgba(234, 67, 53, 0.25);
}

.project-status-badge.ad {
    background: rgba(25, 118, 210, 0.2);
    color: #1976d2;
    border: 1px solid rgba(25, 118, 210, 0.3);
}

/* Ad Grid Preview */
.ad-grid-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 4px;
    width: 100%;
    height: 100%;
}

.ad-grid-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.project-card:hover {
    /* Material Design elevation dp16 */
    box-shadow: 0px 8px 10px -5px rgba(0,0,0,0.2),
                0px 16px 24px 2px rgba(0,0,0,0.14),
                0px 6px 30px 5px rgba(0,0,0,0.12);
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.15);
}

.project-thumbnail {
    width: 100%;
    height: 180px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.project-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;  /* Cover ensures image fills container, may crop */
    object-position: top center;  /* Focus on top/center (header/hero section) */
    display: block;
    image-rendering: -webkit-optimize-contrast;  /* Better quality on resize */
    image-rendering: crisp-edges;
}

.project-thumbnail iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
    background: white;
}

.project-thumbnail-placeholder {
    font-size: 48px;
    opacity: 0.3;
}

.project-thumbnail-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    z-index: 1;
}

.project-card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.project-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

.project-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.project-card-btn {
    flex: 1;
    padding: 0;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

.project-card-btn .material-icons {
    font-size: 20px;
}

.project-card-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    color: #ffffff;
    transform: translateY(-2px);
}

.project-card-btn.project-card-view:hover {
    background: rgba(66, 133, 244, 0.2);
    border-color: rgba(66, 133, 244, 0.4);
    color: #4285f4;
}

.project-card-btn.project-card-edit:hover {
    background: rgba(52, 168, 83, 0.2);
    border-color: rgba(52, 168, 83, 0.4);
    color: #34a853;
}

.project-card-btn.project-card-publish:hover {
    background: rgba(251, 188, 5, 0.2);
    border-color: rgba(251, 188, 5, 0.4);
    color: #fbbc05;
}

.project-card-btn.danger {
    background: rgba(255, 59, 48, 0.08);
    border-color: rgba(255, 59, 48, 0.15);
    color: rgba(255, 59, 48, 0.7);
}

.project-card-btn.danger:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.4);
    color: #ff3b30;
    transform: translateY(-2px);
}

/* Loading State */
.projects-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 16px;
    color: rgba(255,255,255,0.5);
}

/* Empty State */
.projects-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 16px;
}

.projects-empty-icon {
    font-size: 64px;
    opacity: 0.3;
}

.projects-empty-text {
    font-size: 18px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
}

.projects-empty-subtext {
    font-size: 14px;
    color: rgba(255,255,255,0.3);
}

/* Back Button */
.back-button {
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: rgba(255,255,255,0.6);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.back-button .material-icons {
    font-size: 20px;
}

.back-button:hover {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
    transform: translateX(-2px);
}

/* Editor view header adjustments */
#editorView .header-content {
    display: flex;
    align-items: center;
}

#editorView .header-content h1 {
    flex-shrink: 0;
}

#editorView .user-section {
    margin-left: auto;
}

/* Skeleton Loading Cards */
.skeleton-card {
    cursor: default;
    pointer-events: none;
}

.skeleton-card:hover {
    transform: none;
    box-shadow: 0px 5px 5px -3px rgba(0,0,0,0.2),
                0px 8px 10px 1px rgba(0,0,0,0.14),
                0px 3px 14px 2px rgba(0,0,0,0.12);
}

.skeleton-badge,
.skeleton-thumbnail,
.skeleton-title,
.skeleton-meta,
.skeleton-btn {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 6px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 60px;
    height: 24px;
    z-index: 10;
}

.skeleton-thumbnail {
    width: 100%;
    height: 180px;
}

.skeleton-title {
    width: 70%;
    height: 20px;
    margin-bottom: 12px;
}

.skeleton-meta {
    width: 50%;
    height: 14px;
    margin-bottom: 12px;
}

.skeleton-btn {
    flex: 1;
    height: 40px;
    border-radius: 8px;
}
