@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    --accent: #acc90e;
    --accent-hover: #8fa600;
    --text: #1a1a1a;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f5f6f8;
    --white: #ffffff;
    --sidebar-w: 240px;
    --header-h: 60px;
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

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

/* ---- HEADER ---- */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 24px;
    gap: 20px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 160px;
}

.header-logo img { height: 32px; }
.logo-text { font-size: 18px; font-weight: 700; letter-spacing: 2px; color: var(--text); }

.header-search { flex: 1; max-width: 560px; }

.search-form {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.search-btn {
    border: none;
    background: var(--accent);
    color: white;
    padding: 0 14px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background .2s;
}
.search-btn:hover { background: var(--accent-hover); }

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

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

.admin-link {
    background: #f0f9ff;
    color: #0369a1;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.logout-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
}
.logout-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---- LAYOUT ---- */
.page-wrapper {
    display: flex;
    margin-top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
}

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
}

.sidebar-section { margin-bottom: 28px; }

.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 0 20px 10px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all .15s;
    color: var(--text);
}
.sidebar-item:hover { background: #f9fafb; color: var(--accent); }
.sidebar-item.active {
    border-left-color: var(--accent);
    background: rgba(172,201,14,.08);
    color: var(--accent);
    font-weight: 500;
}

.sidebar-item .count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 7px;
    border-radius: 10px;
}
.sidebar-item.active .count { background: rgba(172,201,14,.15); color: var(--accent-hover); }

/* ---- MAIN CONTENT ---- */
.main-content {
    flex: 1;
    padding: 28px 32px;
    min-width: 0;
}

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

.result-info {
    font-size: 13px;
    color: var(--text-muted);
}
.result-info strong { color: var(--text); }

/* ---- GRID ---- */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.file-card {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
}
.file-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
    transform: translateY(-2px);
}

.card-thumb {
    width: 100%;
    aspect-ratio: 3/2;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-icon {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}
.file-icon.pdf { background: #fee2e2; color: #dc2626; }
.file-icon.img { background: #ede9fe; color: #7c3aed; }
.file-icon.video { background: #dbeafe; color: #1d4ed8; }
.file-icon.zip { background: #fef3c7; color: #d97706; }
.file-icon.doc { background: #dbeafe; color: #2563eb; }
.file-icon.ppt { background: #ffedd5; color: #ea580c; }
.file-icon.xls { background: #dcfce7; color: #16a34a; }
.file-icon.other { background: #f3f4f6; color: #6b7280; }

.file-icon svg { width: 36px; height: 36px; }

.card-body {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.card-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.lang-badge {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
}

.download-count { font-size: 11px; color: var(--text-muted); }

.download-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s;
    text-decoration: none;
}
.download-btn:hover { background: var(--accent-hover); }
.download-btn svg { width: 13px; height: 13px; }

.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: .3; }
.empty-state p { font-size: 16px; }

/* ---- LOGIN PAGE ---- */
.login-page {
    display: flex;
    min-height: 100vh;
    font-family: 'Noto Sans KR', sans-serif;
}

.login-bg {
    flex: 1;
    position: relative;
    overflow: hidden;
}
.login-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}
.login-bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom right,
        transparent 40%,
        rgba(0,0,0,.55) 100%
    );
}
.login-bg-footer {
    position: absolute;
    bottom: 36px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}
.login-bg-footer img { height: 36px; filter: brightness(0) invert(1); }
.login-bg-footer .company-name {
    font-size: 15px;
    font-weight: 300;
    letter-spacing: 1px;
    opacity: .9;
}

.login-panel {
    width: 420px;
    min-width: 420px;
    background: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 48px;
    position: relative;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 36px;
}
.login-logo img { height: 48px; }
.login-logo .logo-text-fallback { font-size: 24px; font-weight: 700; letter-spacing: 3px; }
.login-title {
    font-size: 20px;
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
}
.form-control:focus { border-color: var(--accent); }

.btn-primary {
    width: 100%;
    padding: 13px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: .5px;
    transition: background .2s;
    margin-top: 8px;
}
.btn-primary:hover { background: var(--accent-hover); }

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-error { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ---- ADMIN ---- */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.admin-sidebar {
    width: 220px;
    background: #1e2433;
    color: #cbd5e1;
    padding: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
}

.admin-sidebar-logo {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.admin-sidebar-logo .brand { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 1px; }
.admin-sidebar-logo .sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.admin-nav { padding: 16px 0; }

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    color: #94a3b8;
    font-size: 13px;
    transition: all .15s;
}
.admin-nav a:hover { background: rgba(255,255,255,.05); color: white; }
.admin-nav a.active { background: rgba(172,201,14,.12); color: var(--accent); border-left: 3px solid var(--accent); }
.admin-nav a svg { width: 16px; height: 16px; }

.admin-main {
    margin-left: 220px;
    flex: 1;
    padding: 32px;
}

.admin-header {
    margin-bottom: 28px;
}
.admin-header h1 { font-size: 22px; font-weight: 600; color: var(--text); }
.admin-header p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border);
}
.stat-card .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-card .value { font-size: 32px; font-weight: 700; color: var(--text); margin-top: 6px; }
.stat-card .value.accent { color: var(--accent); }

.panel {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 24px;
}
.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-header h3 { font-size: 15px; font-weight: 600; }
.panel-body { padding: 20px; }

.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 11px 14px;
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.badge-admin { background: rgba(172,201,14,.15); color: var(--accent-hover); }
.badge-user { background: var(--bg); color: var(--text-muted); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .2s;
    text-decoration: none;
}
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline { background: white; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s;
}
.upload-area:hover, .upload-area.drag-over { border-color: var(--accent); background: rgba(172,201,14,.04); }
.upload-area p { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

.file-info {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 13px;
    display: none;
}

/* ---- PRODUCT CARD (clickable) ---- */
.product-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.product-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.1); transform: translateY(-2px); }

.product-icon { background: #f0fdf4 !important; color: #16a34a !important; }

/* ---- PRODUCT DETAIL PAGE ---- */
.product-detail {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 40px;
    margin-bottom: 40px;
}
.product-image-wrap {
    background: #f3f4f6;
    border-radius: 12px;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.product-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
}
.product-info { display: flex; flex-direction: column; gap: 16px; }
.product-name { font-size: 28px; font-weight: 700; }
.product-subtitle { font-size: 16px; color: var(--text-muted); }
.product-desc { font-size: 14px; line-height: 1.8; color: #374151; }
.btn-external {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid var(--accent);
    color: var(--accent);
    border-radius: 6px;
    font-weight: 600;
    transition: all .2s;
    text-decoration: none;
}
.btn-external:hover { background: var(--accent); color: white; }
.downloads-section { border-top: 2px solid var(--border); padding-top: 32px; }
.downloads-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
}
.download-item-info { display: flex; align-items: center; gap: 14px; }
.download-label {
    font-size: 13px;
    font-weight: 600;
    background: rgba(172,201,14,.12);
    color: var(--accent-hover);
    padding: 3px 10px;
    border-radius: 4px;
    white-space: nowrap;
}
.download-filename { font-size: 13px; color: var(--text-muted); }
.download-size { font-size: 12px; color: #9ca3af; margin-top: 2px; }

@media (max-width: 768px) {
    .product-detail { grid-template-columns: 1fr; gap: 24px; }
    .product-name { font-size: 22px; }
    .download-item { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ---- UTILITIES ---- */
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.justify-between { justify-content: space-between; }
