/* ============================================
   Maya's Method Studio v3 — Light Mode
   Clean, minimal, Apple-inspired design
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #FEFCF8;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FBFAF7;
    --border: #E8E8E3;
    --border-light: #F0EFE9;
    --text: #1D1D1F;
    --text-secondary: #6E6E73;
    --text-muted: #A1A1A6;
    --accent: #4A9E3F;
    --accent-light: #E8F5E6;
    --accent-hover: #3D8534;
    --danger: #D64545;
    --danger-light: #FDF0F0;
    --amber: #D4930D;
    --amber-light: #FFF8E8;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --radius: 10px;
    --radius-sm: 6px;
    --sidebar-width: 220px;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

img, video {
    max-width: 100%;
    display: block;
}

/* --- Layout --- */
.layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--border-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.logo-text {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.logo-sub {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    padding-left: 42px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: var(--border-light);
    color: var(--text);
}

.nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-item.active svg {
    stroke: var(--accent);
}

.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border-light);
}

.nav-logout {
    color: var(--text-muted);
    font-size: 13px;
}

/* --- Main Content --- */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.content {
    padding: 24px 28px;
    max-width: 1200px;
}

/* --- Flash Messages --- */
.flash-messages {
    padding: 12px 28px 0;
}

.flash {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

.flash-success {
    background: var(--accent-light);
    color: var(--accent-hover);
    border: 1px solid #C8E6C5;
}

.flash-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #F5D5D5;
}

/* --- KPI Cards --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.kpi-green { color: var(--accent); }
.kpi-amber { color: var(--amber); }

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Sections --- */
.section {
    margin-bottom: 28px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text);
}

/* --- Action Cards --- */
.action-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease;
    cursor: pointer;
    text-align: center;
}

.action-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.action-card svg {
    stroke: var(--text-secondary);
}

.action-card:hover svg {
    stroke: var(--accent);
}

.action-card span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* --- Activity Feed --- */
.activity-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.activity-name {
    font-weight: 600;
    font-size: 13.5px;
}

.activity-hook {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 2px 8px;
    border-radius: 4px;
}

.activity-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.activity-progress {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- Status Badges --- */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-complete {
    background: var(--accent-light);
    color: var(--accent-hover);
}

.status-in_progress, .status-running {
    background: var(--amber-light);
    color: var(--amber);
}

.status-review {
    background: #EEF0FF;
    color: #5856D6;
}

.status-approved {
    background: var(--accent-light);
    color: var(--accent);
}

.status-rejected {
    background: var(--danger-light);
    color: var(--danger);
}

.status-unknown {
    background: var(--border-light);
    color: var(--text-muted);
}

/* --- Tab Bar --- */
.tab-bar {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow-x: auto;
    flex-wrap: wrap;
}

.tab {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.tab:hover {
    background: var(--bg-card);
    color: var(--text);
}

.tab.active {
    background: var(--bg-card);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.tab-count {
    display: inline-block;
    background: var(--border-light);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 4px;
}

.tab.active .tab-count {
    background: var(--accent-light);
    color: var(--accent);
}

/* --- Ref Gallery --- */
.ref-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.ref-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.ref-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.ref-thumb {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--border-light);
}

.ref-video-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.ref-info {
    padding: 8px 10px;
}

.ref-name {
    display: block;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ref-folder {
    display: block;
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- File Icon --- */
.file-icon {
    width: 100%;
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--border-light);
    gap: 6px;
}

.file-ext {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* --- Project Cards --- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease;
}

.project-card:hover {
    box-shadow: var(--shadow);
}

.project-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.project-name {
    font-size: 15px;
    font-weight: 600;
}

.project-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.project-type {
    font-weight: 600;
    color: var(--text-secondary);
}

.project-thumbs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    overflow: hidden;
}

.project-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--border-light);
}

.thumb-more {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.project-actions {
    display: flex;
    gap: 8px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

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

.btn-full {
    width: 100%;
    padding: 11px;
}

.btn-approve {
    background: var(--accent-light);
    color: var(--accent-hover);
}

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

.btn-reject {
    background: var(--danger-light);
    color: var(--danger);
}

.btn-reject:hover {
    background: var(--danger);
    color: white;
}

/* --- Upload --- */
.upload-section {
    margin-bottom: 20px;
}

.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    transition: border-color 0.2s ease;
    background: var(--bg-card);
}

.upload-dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.dropzone-text {
    color: var(--text-muted);
    font-size: 13px;
    margin: 10px 0 16px;
}

.upload-form #file-input {
    margin: 0 auto 12px;
}

.upload-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.upload-category {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text);
}

.upload-form-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
}

.upload-form-inline select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    background: var(--bg);
}

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox.hidden {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-card);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Empty State --- */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    grid-column: 1 / -1;
}

/* --- Login --- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-container {
    width: 100%;
    max-width: 380px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 28px;
    box-shadow: var(--shadow-md);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header .logo {
    justify-content: center;
    margin-bottom: 12px;
}

.login-header .logo-icon {
    width: 48px;
    height: 48px;
    font-size: 22px;
}

.login-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 2px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.15s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* --- Responsive --- */
@media (max-width: 960px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .action-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .logo-text, .logo-sub, .nav-item span, .sidebar-footer span {
        display: none;
    }
    .nav-item {
        justify-content: center;
        padding: 10px;
    }
    .main {
        margin-left: 60px;
    }
    .content {
        padding: 16px;
    }
    .ref-gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}
