/* --- VARIABLES & RESET --- */
:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }

/* --- HEADER --- */
header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
}

.nav-links { display: flex; gap: 20px; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover { color: var(--primary); }

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline { border: 2px solid var(--border); background: transparent; color: var(--text-main); }
.btn-outline:hover { border-color: var(--text-main); }

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* --- VIEWS CONTROLLER --- */
.view-section {
    display: none;
    flex: 1;
    padding: 40px 0;
    animation: fadeIn 0.4s ease;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- HERO --- */
.hero {
    text-align: center;
    margin-bottom: 3rem;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 10px; color: var(--text-main); }
.hero p { font-size: 1.1rem; color: var(--text-light); max-width: 600px; margin: 0 auto; }

/* --- FILTERS --- */
.filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.filter-btn {
    background: white;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light);
}
.filter-btn.active, .filter-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* --- DEMO VIEW STYLES --- */
#view-demo {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background: #000;
    overflow: hidden;
}

#view-demo.active {
    display: block !important; 
}

.demo-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: #2563eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #2563eb;
    z-index: 2001;
}

#demo-bar-title {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 15px;
    flex: 1;
    min-width: 0;
}

.demo-bar button {
    flex-shrink: 0; 
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

#demo-frame {
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    height: calc(100% - 50px);
    border: none;
    display: block;
    background: transparent;
}

body.demo-mode { overflow: hidden; }
body.demo-mode header, body.demo-mode footer { display: none; }

/* --- PROJECTS GRID --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    cursor: pointer; 
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.card-img {
    height: 180px;
    background-color: #cbd5e1;
    position: relative;
    overflow: hidden;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title { font-size: 1.25rem; margin-bottom: 8px; }
.card-desc { color: var(--text-light); font-size: 0.9rem; margin-bottom: 20px; flex: 1; }

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 15px;
    margin-top: auto;
}

/* --- DETAIL VIEW --- */
.project-header { margin-bottom: 30px; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-light);
    margin-bottom: 15px;
    cursor: pointer;
    font-weight: 600;
}
.back-link:hover { color: var(--primary); }

.detail-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.detail-main img {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.detail-content h2 { margin-bottom: 15px; font-size: 1.8rem; }
.detail-content p { margin-bottom: 15px; color: var(--text-light); }

.feature-list { margin: 20px 0; padding-left: 20px; list-style: disc; color: var(--text-light); }
.feature-list li { margin-bottom: 8px; }

.detail-sidebar {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    height: fit-content;
}

.sidebar-item { margin-bottom: 25px; }
.sidebar-item h3 { font-size: 1rem; margin-bottom: 10px; color: var(--text-main); }

.tech-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
    background: #f1f5f9;
    color: var(--text-light);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.action-buttons { display: flex; flex-direction: column; gap: 10px; }

/* --- FOOTER --- */
footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-light);
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .detail-layout { grid-template-columns: 1fr; }
    .nav-links { display: none; }
}

@media (max-width: 600px) {
    .demo-bar {
        padding: 0 10px;
    }
    
    #demo-bar-title {
        font-size: 0.9rem;
    }

    .demo-bar button span {
        display: none;
    }
}