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

:root {
    --bg: #222222;
    --bg-card: #2a2a2a;
    --bg-hover: #333333;
    --accent: #A81643;
    --accent-hover: #c41a52;
    --text: #e0e0e0;
    --text-muted: #999;
    --border: #3a3a3a;
    --radius: 10px;
    --font-display: 'Clash Display', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

/* === LOGIN PAGE === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2rem;
}
.login-container { width: 100%; max-width: 420px; }
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
}
.login-logo h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    color: var(--text);
}
.login-logo h1 span { color: var(--accent); }
.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.3rem;
    margin-bottom: 2rem;
}
.login-form .input-group { margin-bottom: 1.5rem; }
.login-form label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}
.login-form input[type="text"] {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.2s;
}
.login-form input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
}
.input-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.4rem; }
.btn-primary {
    width: 100%;
    padding: 0.85rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.login-error {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: var(--radius);
    color: #f87171;
    font-size: 0.9rem;
    text-align: center;
}
.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2rem;
}

/* === HEADER === */
.portal-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 60px;
    gap: 2rem;
}
.header-logo {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}
.header-logo span { color: var(--accent); }

/* === HAMBURGER === */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 101;
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* === NAV === */
.header-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--bg-hover); }
.nav-link.active { color: #fff; background: var(--accent); }
.header-actions { margin-left: auto; }
.btn-logout {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-logout:hover { color: #f87171; background: var(--bg-hover); }

/* === MAIN === */
.portal-main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.project-header { margin-bottom: 1rem; }
.project-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
}
.project-code { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }
.project-code span { color: var(--accent); font-family: monospace; font-size: 0.9rem; }

/* === WELCOME BANNER (no red line) === */
.welcome-banner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: var(--text);
}

/* === START HERE === */
.start-here-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}
.start-here-card h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 1.25rem;
    color: var(--text);
}
.start-here-steps {
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.start-here-steps li {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.5;
    padding-left: 0.5rem;
}
.start-here-steps li::marker { color: var(--accent); font-weight: 600; }

/* === TABS === */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === SECTION HEADER === */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.section-header h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; }
.section-actions { display: flex; gap: 0.5rem; }
.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}
.btn-icon:hover { color: var(--text); border-color: var(--text-muted); }

/* === BREADCRUMB === */
.breadcrumb {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}
.breadcrumb-item { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.breadcrumb-item:hover { color: var(--text); }
.breadcrumb-item.active { color: var(--accent); }
.breadcrumb-item + .breadcrumb-item::before { content: '/'; color: var(--text-muted); margin-right: 0.5rem; }

/* === SUBFOLDERS === */
.subfolders { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.subfolder-chip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s;
}
.subfolder-chip:hover { color: var(--text); border-color: var(--text-muted); }
.subfolder-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* === LOADING & EMPTY === */
.loading-state, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    gap: 1rem;
}
.spinner {
    width: 32px;
    height: 32px;
    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); } }

/* === FILE GRID === */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}
.file-grid.list-view { grid-template-columns: 1fr; gap: 0.5rem; }

/* === FILE CARD === */
.file-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}
.file-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.file-grid.list-view .file-card {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
}

/* === THUMB AREA === */
.thumb-area {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.file-grid.list-view .thumb-area {
    width: 56px;
    height: 56px;
    aspect-ratio: auto;
    border-radius: 6px;
}
.file-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.file-thumb-fallback {
    font-size: 3rem;
    line-height: 1;
    opacity: 0.6;
}
.file-grid.list-view .file-thumb-fallback { font-size: 1.5rem; }

/* === VIDEO PLAY OVERLAY === */
.video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.file-card:hover .video-overlay { opacity: 1; }
.play-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
}
.file-grid.list-view .play-icon { width: 28px; height: 28px; font-size: 0.7rem; }

/* === DOWNLOAD BUTTON === */
.file-download-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: all 0.2s;
    opacity: 0;
    z-index: 2;
    text-decoration: none;
}
.file-card:hover .file-download-btn { opacity: 1; }
.file-download-btn:hover { background: var(--accent); color: #fff; }
.file-download-btn svg { flex-shrink: 0; }

.file-grid.list-view .file-download-btn {
    position: static;
    opacity: 1;
    background: transparent;
    color: var(--text-muted);
    width: auto;
    height: auto;
    padding: 0.35rem;
    border-radius: 6px;
}
.file-grid.list-view .file-download-btn:hover {
    color: var(--accent);
    background: var(--bg-hover);
}

/* === FILE INFO === */
.file-info {
    padding: 0.65rem 0.85rem 0.75rem;
    flex: 1;
    min-width: 0;
}
.file-grid.list-view .file-info { padding: 0; flex: 1; }
.file-name {
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }

/* === MILESTONES === */
.milestones-list { display: flex; flex-direction: column; }
.milestone-item { display: flex; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border); }
.milestone-item:last-child { border-bottom: none; }
.milestone-indicator {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--bg-hover);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.85rem; flex-shrink: 0;
}
.milestone-item.completed .milestone-indicator { background: var(--accent); color: #fff; }
.milestone-name { font-weight: 600; font-size: 1rem; }
.milestone-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem; }

/* === INFO === */
.info-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.info-link { display: block; color: var(--accent); text-decoration: none; margin-top: 0.5rem; font-weight: 500; }
.info-link:hover { text-decoration: underline; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .header-inner { padding: 0 1rem; gap: 0.75rem; }
    .hamburger { display: flex; }
    .header-nav {
        display: none;
        position: absolute;
        top: 60px; left: 0; right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 0.75rem 1rem;
        gap: 0.25rem;
    }
    .header-nav.open { display: flex; }
    .nav-link { padding: 0.7rem 1rem; border-radius: 8px; }
    .header-actions { margin-left: auto; }
    .portal-main { padding: 1.5rem 1rem; }
    .project-title { font-size: 1.4rem; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .login-card { padding: 2rem 1.5rem; }
    .start-here-card { padding: 1.5rem; }
}
