:root {
	--primary: #4f46e5;
	--primary-dark: #4338ca;
	--bg-body: #f3f4f6;
	--bg-card: #ffffff;
	--text-main: #111827;
	--text-muted: #6b7280;
	--border: #e5e7eb;
	--danger: #ef4444;
	--success: #10b981;
	--warning: #f59e0b;
}

[x-cloak] { display: none !important; }

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text-main); background: var(--bg-body); }

/* --- Layout --- */
.mcw-app-body { display: flex; min-height: 100vh; flex-direction: column; } /* Changed for mobile flow */
@media(min-width: 769px) { .mcw-app-body { flex-direction: row; } }

.app-sidebar { width: 260px; background: white; border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; height: 100%; z-index: 20; transition: transform 0.3s ease; }
.app-main { flex: 1; padding: 2rem; margin-left: 260px; max-width: 1200px; width: 100%; }

/* Mobile Header (New) */
.mobile-header { display: none; padding: 1rem; background: white; border-bottom: 1px solid var(--border); align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 15; }
.hamburger { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-main); padding: 5px; }

/* Overlay (New) */
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 18; }
.sidebar-overlay.show { display: block; }

/* Mobile Adjustments */
@media (max-width: 768px) {
    .app-sidebar { 
        transform: translateX(-100%); /* Hide off-screen by default */
        box-shadow: 0 0 15px rgba(0,0,0,0.1);
    }
    .app-sidebar.mobile-active {
        transform: translateX(0); /* Slide in */
    }
    .app-main { margin-left: 0; padding: 1rem; margin-top: 0; }
    .mobile-header { display: flex; } /* Show header on mobile */
}

/* Sidebar Elements */
.brand { padding: 1.5rem; font-weight: 800; font-size: 1.2rem; border-bottom: 1px solid var(--border); display: flex; justify-content: center; align-items: center; gap:10px; }
.brand img { max-height: 32px; width: auto; }
.user-info { padding: 1.5rem; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.avatar { width: 40px; height: 40px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; flex-shrink: 0; font-size: 1.2rem; }
.details { display: flex; flex-direction: column; overflow: hidden; }
.details span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 0.95rem; }
.details small { color: var(--text-muted); font-size: 0.8rem; }

.main-nav { padding: 1rem; display: flex; flex-direction: column; gap: 4px; }
.nav-label { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin: 20px 0 8px 10px; letter-spacing: 0.05em; }
.main-nav a { padding: 10px 12px; border-radius: 6px; cursor: pointer; color: var(--text-muted); text-decoration: none; font-size: 0.95rem; display: flex; align-items: center; gap: 10px; transition: all 0.2s; }
.main-nav a:hover { background: #f9fafb; color: var(--text-main); }
.main-nav a.active { background: #eef2ff; color: var(--primary); font-weight: 600; }
.main-nav a.logout { color: var(--danger); margin-top: 20px; }
.main-nav a.logout:hover { background: #fef2f2; }

/* Content & Grid */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; gap: 20px; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 1.8rem; color: var(--text-main); }
.filters-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.search-input { padding: 10px; border: 1px solid var(--border); border-radius: 6px; width: 300px; max-width: 100%; }

.data-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.data-card { background: white; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; }
.data-card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.card-img { height: 160px; background: #e5e7eb; background-size: cover; background-position: center; flex-shrink: 0; position: relative; }
.card-img-placeholder { height: 160px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; color: #d1d5db; font-size: 3rem; border-bottom: 1px solid var(--border); }

.card-content { padding: 1.2rem; flex: 1; display: flex; flex-direction: column; }
.card-content h3 { margin: 0 0 0.5rem 0; font-size: 1.1rem; line-height: 1.4; color: var(--text-main); }
.meta-tags { display: flex; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap; }
.tag { font-size: 0.75rem; background: #f3f4f6; color: var(--text-muted); padding: 4px 8px; border-radius: 4px; font-weight: 600; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: auto; padding-top: 15px; border-top: 1px solid #f3f4f6; }

/* Buttons & Pagination */
.btn { padding: 8px 16px; border-radius: 6px; border: none; font-weight: 500; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.9rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.7; cursor: wait; }
.btn-secondary { background: white; border: 1px solid var(--border); color: var(--text-main); }
.btn-secondary:hover { background: #f9fafb; border-color: #d1d5db; }
.btn-icon { background: white; border: 1px solid var(--border); width: 32px; height: 32px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: 0.2s; }
.btn-icon:hover { color: var(--primary); border-color: var(--primary); }
.btn-icon.danger:hover { color: var(--danger); border-color: var(--danger); background: #fef2f2; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 15px; margin-top: 30px; }
.page-info { font-size: 0.9rem; color: var(--text-muted); }

/* Quota & Forms */
.quota-card { background: white; padding: 20px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 20px; }
.quota-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; }
.progress-bg { background: #f3f4f6; height: 8px; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.5s ease; }

.form-container { background: white; padding: 2rem; border-radius: 8px; border: 1px solid var(--border); max-width: 800px; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; color: var(--text-main); }
.form-input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; transition: border-color 0.2s; }
.form-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }
.form-helper { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; }

/* Uploader */
.upload-area { border: 2px dashed var(--border); border-radius: 8px; padding: 20px; text-align: center; cursor: pointer; transition: 0.2s; background: #fafafa; position: relative; }
.upload-area:hover { border-color: var(--primary); background: #f0fdf4; }
.upload-preview { height: 200px; background-size: contain; background-repeat: no-repeat; background-position: center; margin-bottom: 10px; }
.upload-text { color: var(--text-muted); font-size: 0.9rem; pointer-events: none; }
.upload-loader { position: absolute; top:0; left:0; right:0; bottom:0; background: rgba(255,255,255,0.8); display: flex; align-items: center; justify-content: center; font-weight: bold; color: var(--primary); }

/* Modal */
.modal-overlay { position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
.modal-box { background: white; width: 100%; max-width: 600px; border-radius: 12px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); max-height: 90vh; display: flex; flex-direction: column; animation: modalUp 0.3s ease-out; }
@keyframes modalUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #f3f4f6; }
.close-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }

/* Toast */
.toast-container { position: fixed; bottom: 30px; right: 30px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #1f2937; color: white; padding: 12px 24px; border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); font-size: 0.9rem; }
.toast-error { background: var(--danger); }
.toast-success { background: var(--success); }

/* API Box */
.api-box { background: white; padding: 2rem; border-radius: 8px; border: 1px solid var(--border); }
.key-display { display: flex; gap: 10px; margin: 1rem 0; align-items: center; }
.key-display input { background: #f9fafb; font-family: monospace; letter-spacing: 1px; color: var(--primary); font-weight: bold; }