/* Dashboard (Start Screen) */
#dashboard-overlay {
    position: fixed;
    top: 7vh;
    left: 2.5vw;
    width: 95vw;
    height: 88vh;
    background-color: #f5f5f5;
    z-index: 999998; /* Just behind the splash screen */
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: var(--ui-text);
    transition: opacity 0.3s ease;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 0 0 100vw rgba(0,0,0,0.3), 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid var(--ui-border);
}

body.dark-mode #dashboard-overlay {
    background-color: #121212;
    color: #e0e0e0;
}

/* Header */
.dashboard-header {
    height: 60px;
    background-color: var(--ui-theme-color);
    border-bottom: none;
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
    flex-shrink: 0;
}

body.dark-mode .dashboard-header {
    background-color: var(--ui-theme-color);
    border-bottom: none;
}

.dashboard-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}

body.bright-theme .dashboard-logo {
    color: #111111;
}

.dashboard-logo i {
    font-size: 1.4rem;
}

.dashboard-search {
    position: relative;
    width: 400px;
}

.dashboard-search input {
    width: 100%;
    padding: 8px 12px 8px 35px;
    border: 1px solid var(--ui-border);
    border-radius: 20px;
    background-color: var(--ruler-bg);
    color: var(--ui-text);
    outline: none;
    font-size: 0.95rem;
}

body.dark-mode .dashboard-search input {
    background-color: #2d2d2d;
    border-color: #444;
}

.dashboard-search input:focus {
    border-color: var(--ui-theme-color);
}

.dashboard-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ui-text-muted);
}

.dashboard-skip-btn {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #ffffff;
    border-radius: 4px;
    cursor: pointer;
    color: var(--ui-theme-color);
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

body.bright-theme .dashboard-skip-btn {
    color: #111111;
    border-color: #111111;
    background: transparent;
}

body.bright-theme .dashboard-skip-btn:hover {
    background: rgba(0,0,0,0.1);
}

body.bright-theme .dashboard-header .custom-dialog-close {
    color: #111111;
    background: rgba(0,0,0,0.15);
}

body.bright-theme .dashboard-header .custom-dialog-close:hover {
    background: rgba(235, 87, 87, 0.9);
    color: #ffffff;
}

.dashboard-skip-btn:hover {
    background-color: #f0f0f0;
    border-color: #f0f0f0;
    color: var(--ui-theme-dark);
}

body.dark-mode .dashboard-skip-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Main Layout */
.dashboard-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Nav */
.dashboard-nav {
    width: 250px;
    background-color: var(--pub-dark);
    color: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

body.dark-mode .dashboard-nav {
    background-color: #1a1a1a;
    border-right: 1px solid #333;
}

.dashboard-nav-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    transition: background 0.2s;
}

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

.dashboard-nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dashboard-nav-item.active {
    background-color: var(--ui-theme-color);
    font-weight: 600;
}

body.bright-theme .dashboard-nav-item.active {
    color: #111111;
}

.dashboard-nav-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.15);
    margin: 10px 20px;
}

.dashboard-nav-label {
    padding: 10px 20px 5px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
}

/* Main Content Area */
.dashboard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 40px;
}

.dashboard-tab-pane {
    display: none;
    flex-direction: column;
    gap: 30px;
}

.dashboard-tab-pane.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.dashboard-section-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.dashboard-section-title a {
    font-size: 0.9rem;
    color: var(--ui-theme-color);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.dashboard-section-title a:hover {
    text-decoration: underline;
}

/* Blank Sizes */
.dashboard-blank-grid {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 10px 5px 15px 5px; /* Added padding to prevent hover cropping */
    margin: -10px -5px -5px -5px; /* Offset padding */
    scrollbar-width: none; /* Firefox */
}

.dashboard-blank-grid::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.blank-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.blank-card-preview {
    background-color: white;
    border: 1px solid var(--ui-border);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--ui-theme-color);
    font-size: 1.5rem;
}

body.dark-mode .blank-card-preview {
    background-color: #2a2a2a;
    border-color: #444;
}

.blank-card:hover .blank-card-preview {
    border-color: var(--ui-theme-color);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.blank-card-title {
    font-weight: 500;
    font-size: 0.95rem;
}

.blank-card-desc {
    font-size: 0.8rem;
    color: var(--ui-text-muted);
}

/* Template Grid */
.dashboard-template-grid {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 10px 5px 15px 5px; /* Added padding to prevent hover cropping */
    margin: -10px -5px -5px -5px; /* Offset padding */
    scrollbar-width: none; /* Firefox */
}

.dashboard-template-grid::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.dashboard-template-card {
    flex-shrink: 0;
    width: 200px;
    cursor: pointer;
    transition: all 0.2s;
}

.dashboard-template-card:hover {
    transform: translateY(-2px);
}

.dashboard-template-preview {
    width: 100%;
    height: 282px; /* A4 aspect approx */
    background-color: white;
    border: 1px solid var(--ui-border);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

body.dark-mode .dashboard-template-preview {
    background-color: #2a2a2a;
    border-color: #444;
}

.dashboard-template-card:hover .dashboard-template-preview {
    border-color: var(--ui-theme-color);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.dashboard-template-title {
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-template-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(13, 158, 143, 0.72);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: bold;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Open Tab */
.dashboard-open-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 20px;
}

.dashboard-dropzone {
    width: 100%;
    max-width: 600px;
    height: 250px;
    border: 2px dashed var(--ui-theme-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 118, 112, 0.05);
    cursor: pointer;
    transition: all 0.2s;
}

body.dark-mode .dashboard-dropzone {
    background-color: rgba(0, 118, 112, 0.1);
}

.dashboard-dropzone:hover {
    background-color: rgba(0, 118, 112, 0.1);
    transform: scale(1.02);
}

.dashboard-dropzone i {
    font-size: 4rem;
    color: var(--ui-theme-color);
    margin-bottom: 15px;
}

.dashboard-dropzone p {
    font-size: 1.2rem;
    font-weight: 500;
    margin: 0;
}

.dashboard-dropzone span {
    color: var(--ui-text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Coming Soon Badge */
.coming-soon-badge {
    background-color: #666;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    font-weight: 600;
    text-transform: uppercase;
}

.dashboard-nav-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.dashboard-recent-empty {
    text-align: center;
    padding: 50px;
    color: var(--ui-text-muted);
    font-size: 1.1rem;
}

.dashboard-recent-empty i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Recent Grid */
.dashboard-recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* Expanded Category Grid */
.dashboard-expanded-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* Scroll Buttons Container */
.dashboard-grid-container {
    position: relative;
    display: block;
}

.dashboard-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: white;
    color: var(--ui-text);
    border: 1px solid var(--ui-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
}

.dashboard-scroll-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.dashboard-scroll-btn:hover {
    background-color: var(--ui-theme-color);
    color: white;
    border-color: var(--ui-theme-color);
    transform: translateY(-50%) scale(1.1);
}

body.dark-mode .dashboard-scroll-btn {
    background-color: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-mode .dashboard-scroll-btn:hover {
    background-color: var(--ui-theme-color);
    color: white;
}

.dashboard-scroll-left {
    left: -20px;
}

.dashboard-scroll-right {
    right: -20px;
}
