/* ===========================================
   DASHBOARD STYLES — Robert Hidri Portfolio
   Matches the landing page dark theme
   =========================================== */

:root {
    --bg:          #0c0f14;
    --bg-surface:  #141820;
    --bg-card:     #1a1f2b;
    --bg-alt:      #0f1219;
    --border:      #2a3040;
    --border-hover:#3d4860;

    --text:        #e2e8f0;
    --text-muted:  #8892a4;
    --text-dim:    #5a6478;

    --accent:      #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --accent-dark: #2563eb;

    --color-projects: #3b82f6;
    --color-tools:    #a855f7;
    --color-iot:      #10b981;
    --color-learning: #f59e0b;

    --font:       'DM Sans', -apple-system, sans-serif;
    --font-mono:  'JetBrains Mono', 'Courier New', monospace;

    --radius:     0.625rem;
    --radius-lg:  1rem;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.dashboard-header {
    background: rgba(12, 15, 20, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.875rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-back {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
    white-space: nowrap;
}
.header-back:hover { color: var(--accent); }

.header-content h1 {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header-tag {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--text-dim);
    letter-spacing: 0.04em;
}

.header-links {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-link {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.header-link:hover {
    background: var(--accent);
    color: white;
}

/* --- Main --- */
.dashboard-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* --- Controls --- */
.controls {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-bar {
    position: relative;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    pointer-events: none;
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    font-family: var(--font);
    font-size: 0.875rem;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2rem;
    outline: none;
    transition: all var(--transition);
}
.search-bar input::placeholder { color: var(--text-dim); }
.search-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.filters {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.4rem 1rem;
    font-family: var(--font);
    font-size: 0.8125rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.filter-btn:hover {
    border-color: var(--border-hover);
    color: var(--text);
}
.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* --- Tile Grid --- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: var(--text-dim);
}

.loading::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    margin: 0 auto 1rem;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Tiles --- */
.tile {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: tileIn 0.4s ease both;
}

.tile:nth-child(1) { animation-delay: 0.03s; }
.tile:nth-child(2) { animation-delay: 0.06s; }
.tile:nth-child(3) { animation-delay: 0.09s; }
.tile:nth-child(4) { animation-delay: 0.12s; }
.tile:nth-child(5) { animation-delay: 0.15s; }
.tile:nth-child(6) { animation-delay: 0.18s; }
.tile:nth-child(7) { animation-delay: 0.21s; }
.tile:nth-child(8) { animation-delay: 0.24s; }

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

.tile:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.lock-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1rem;
    opacity: 0.5;
}

.tile-icon {
    font-size: 2.25rem;
}

.tile-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.tile-description {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex-grow: 1;
    margin: 0;
}

.tile-footer {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.tile-category {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.625rem;
    border-radius: 2rem;
}

/* Category colors */
.tile[data-category="projects"] .tile-category {
    color: var(--color-projects);
    background: rgba(59, 130, 246, 0.1);
}
.tile[data-category="projects"]:hover {
    border-color: rgba(59, 130, 246, 0.3);
}

.tile[data-category="tools"] .tile-category {
    color: var(--color-tools);
    background: rgba(168, 85, 247, 0.1);
}
.tile[data-category="tools"]:hover {
    border-color: rgba(168, 85, 247, 0.3);
}

.tile[data-category="iot"] .tile-category {
    color: var(--color-iot);
    background: rgba(16, 185, 129, 0.1);
}
.tile[data-category="iot"]:hover {
    border-color: rgba(16, 185, 129, 0.3);
}

.tile[data-category="learning"] .tile-category {
    color: var(--color-learning);
    background: rgba(245, 158, 11, 0.1);
}
.tile[data-category="learning"]:hover {
    border-color: rgba(245, 158, 11, 0.3);
}

/* --- Modal --- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal.active { display: flex; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    position: relative;
    z-index: 1001;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    animation: modalUp 0.3s ease;
}

@keyframes modalUp {
    from { opacity: 0; transform: translateY(40px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover {
    background: var(--bg-card);
    color: var(--text);
}

.modal-header {
    padding: 2rem 2rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.category-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.625rem;
    color: var(--accent);
    background: var(--accent-glow);
    border-radius: 2rem;
}

.modal-body {
    padding: 1.5rem 2rem;
}

.module-summary {
    font-size: 0.9375rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

/* Projects inside modal */
.projects-section { margin-top: 1rem; }

.projects-section h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color var(--transition);
}
.project-card:hover { border-color: var(--border-hover); }

.project-card h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0 0 0.375rem 0;
}

.project-card p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem 0;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.tech-tag {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
}

.project-status {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.2rem 0.625rem;
    border-radius: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.project-status.active    { color: #10b981; background: rgba(16,185,129,0.1); }
.project-status.completed { color: #3b82f6; background: rgba(59,130,246,0.1); }
.project-status.in-progress { color: #f59e0b; background: rgba(245,158,11,0.1); }
.project-status.planning  { color: #a855f7; background: rgba(168,85,247,0.1); }

/* Skills inside modal */
.skills-section { margin-top: 1.5rem; }

.skills-section h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
}

.skills-list li {
    font-size: 0.8125rem;
    padding: 0.375rem 0.875rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2rem;
    color: var(--text-muted);
}

.modal-footer {
    padding: 1rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* --- Buttons --- */
.btn {
    padding: 0.625rem 1.25rem;
    font-family: var(--font);
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--bg-alt);
    color: var(--text);
}

/* --- Interactive Tools --- */
.tools-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.tool-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    transition: all var(--transition);
}
.tool-item:hover { border-color: var(--border-hover); }

.tool-item h4 {
    font-size: 0.875rem;
    margin: 0 0 0.25rem 0;
}
.tool-item p {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin: 0 0 0.75rem 0;
}

.tool-workspace {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.tool-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
}

/* Calculator */
.calculator { max-width: 300px; margin: 0 auto; }

.calc-display {
    width: 100%;
    padding: 1.25rem;
    font-family: var(--font-mono);
    font-size: 1.75rem;
    text-align: right;
    color: var(--text);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.375rem;
    outline: none;
}

.calc-operation {
    text-align: right;
    padding: 0.25rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-dim);
    min-height: 1.25rem;
    margin-bottom: 0.5rem;
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.375rem;
}

.calc-btn {
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 1.125rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
}
.calc-btn:hover {
    background: var(--bg-alt);
    border-color: var(--border-hover);
}
.calc-btn:active { transform: scale(0.96); }

.calc-operator {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    border-color: rgba(59, 130, 246, 0.2);
}
.calc-operator:hover { background: rgba(59, 130, 246, 0.25); }

.calc-equals {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
}
.calc-equals:hover { background: rgba(16, 185, 129, 0.25); }

.calc-clear {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.15);
}
.calc-clear:hover { background: rgba(239, 68, 68, 0.2); }

/* Text tools */
.tool-textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.875rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
    margin-bottom: 0.75rem;
    outline: none;
    transition: border-color var(--transition);
}
.tool-textarea:focus { border-color: var(--accent); }
.tool-textarea::placeholder { color: var(--text-dim); }

.tool-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.tool-output {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem;
    min-height: 80px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-muted);
}
.tool-output pre { margin: 0; }

/* --- Project Links --- */
.project-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.project-link {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
}
.project-link:hover {
    color: #60a5fa;
}

/* --- Areas (Hobbies) --- */
.areas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.area-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all var(--transition);
}
.area-card:hover {
    border-color: var(--border-hover);
}

.area-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.area-card h4 {
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.area-card p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* --- Downloads (CV) --- */
.downloads-section {
    margin-top: 1.5rem;
}

.downloads-section h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
}

.download-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.download-card.placeholder {
    opacity: 0.6;
}

.download-info h4 {
    font-size: 0.9375rem;
    margin-bottom: 0.125rem;
}

.download-info p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

.download-status {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    padding: 0.25rem 0.75rem;
    background: var(--bg-surface);
    border-radius: 2rem;
}

/* --- Roadmap (Certificates) --- */
.roadmap-section {
    margin-top: 1.5rem;
}

.roadmap-section h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.roadmap-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.roadmap-info {
    flex: 1;
    min-width: 200px;
}

.roadmap-info h4 {
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.roadmap-info p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.roadmap-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.roadmap-priority {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.2rem 0.625rem;
    border-radius: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.roadmap-priority.high {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}
.roadmap-priority.medium {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}
.roadmap-priority.low {
    color: var(--text-dim);
    background: rgba(90, 100, 120, 0.1);
}

/* --- Footer --- */
.footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    text-align: center;
}
.footer p {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin: 0;
}

/* --- Light Mode (toggle-based) --- */
[data-theme="light"] {
    --bg:          #f8f9fb;
    --bg-surface:  #ffffff;
    --bg-card:     #ffffff;
    --bg-alt:      #f1f3f7;
    --border:      #d1d5db;
    --border-hover:#9ca3af;

    --text:        #1f2937;
    --text-muted:  #4b5563;
    --text-dim:    #6b7280;

    --accent:      #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.15);
    --accent-dark: #1d4ed8;
}

[data-theme="light"] .dashboard-header {
    background: rgba(248, 249, 251, 0.9);
}

[data-theme="light"] .modal-backdrop {
    background: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .tile:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

/* --- Theme Toggle Button --- */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--text);
}

/* --- Focus Indicators --- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .header-content {
        padding: 0.75rem 1.25rem;
    }
    .header-tag { display: none; }
    .dashboard-main { padding: 1.25rem; }
    .tile-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }
    .modal-content { max-height: 95vh; }
    .modal-header, .modal-body, .modal-footer { padding-left: 1.25rem; padding-right: 1.25rem; }
}

@media (max-width: 480px) {
    .tile-grid { grid-template-columns: 1fr; }
    .filters { flex-direction: column; }
    .filter-btn { width: 100%; }
}
