/* 
* CraftBox Archive Theme 
* Style: Minimalist, Content-Focused, No-Icons
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    /* Color Palette - Minimalist */
    --bg-color: #ffffff;
    --bg-secondary: #f9fafb;

    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-tertiary: #9ca3af;

    --border-color: #e5e7eb;
    --accent-color: #2563eb;
    /* Professional Blue */

    /* Spacing */
    --container-width: 1000px;
    --header-height: 60px;

    /* Typography */
    --font-main: 'Inter', 'Noto Sans KR', sans-serif;
}

/* Background Gradient - Premium Clean Style */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    /* Soft, Modern Gradient (Won't get tired easily) */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    /* Option 2: Warmer */
    /* background: linear-gradient(to top, #f3e7e9 0%, #e3eeff 99%, #e3eeff 100%); */
}

/* Shapes removed for cleaner look */

/* Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.15s;
}

ul {
    list-style: none;
}

/* Layout */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    z-index: 50;
}

.header-inner {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-link {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 4px;
    /* Slightly rounded, not full pill */
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.btn-primary {
    background-color: var(--text-primary);
    color: white;
}

.btn-primary:hover {
    background-color: #000;
}

.btn-outline {
    border-color: var(--border-color);
    color: var(--text-primary);
    background: white;
}

.btn-outline:hover {
    border-color: var(--text-primary);
}

/* Main Content */
.main {
    padding: 60px 0 100px;
}

.page-title-section {
    margin-bottom: 60px;
    text-align: center;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.page-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Sections */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--text-primary);
}

/* Resource Grid Layout (Card Style) */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.resource-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

.resource-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.resource-card-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.resource-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
    line-height: 1.4;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.resource-card-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-card-footer {
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resource-item {
    background: white;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.15s;
}

.resource-item:hover {
    background-color: var(--bg-secondary);
}

.resource-info {
    flex: 1;
}

.resource-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.tag {
    padding: 2px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-weight: 500;
}

.resource-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: block;
}

.resource-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.resource-action {
    margin-left: 30px;
}

/* Simple Grid for Tools */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 60px;
}

.tool-card {
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 4px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.tool-card:hover {
    border-color: var(--text-primary);
}

.tool-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1rem;
}

.tool-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    flex-grow: 1;
}

.link-text {
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }

    .header-inner {
        flex-direction: column;
        gap: 16px;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }

    .resource-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .resource-action {
        margin-left: 0;
        width: 100%;
    }

    .resource-action .btn {
        width: 100%;
        text-align: center;
    }
}

/* Auth Pages */
.auth-container {
    max-width: 400px;
    margin: 80px auto;
    background: white;
    padding: 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
    transition: border-color 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--text-primary);
}

.form-actions {
    margin-top: 24px;
}

.form-actions .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 12px;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-footer a {
    text-decoration: underline;
    color: var(--text-primary);
}

/* Password Requirements (Register) */
.password-requirements {
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.requirement {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.requirement.valid {
    color: var(--accent-color);
    /* Blue for valid */
}

/* Alerts */
.alert {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Login Modal - 수정됨 */
.modal-overlay {
    display: none;
    /* 기본적으로 숨김 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    visibility: hidden;
    /* 추가: 완전히 숨김 */
}

.modal-overlay.active {
    display: flex !important;
    /* 강제 적용 */
    opacity: 1;
    visibility: visible;
    /* 추가: 보이기 */
}

.modal-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    position: relative;
    text-align: left;
}

/* Ensure form elements inside modal are styled */
.modal-box .form-group {
    margin-bottom: 20px;
}

.modal-box .form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
    line-height: 1;
}

.modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modal-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.modal-footer a {
    color: var(--accent-color);
    font-weight: 600;
}

/* Upload Page Styles */
.upload-form-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background: #f9fafb;
    transition: all 0.2s;
}

.form-control:focus {
    background: white;
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
}

/* Full Width Main Container */
.main-full {
    width: 100%;
    padding: 20px 40px;
    /* No max-width */
}

.file-upload-wrapper {
    border: 2px dashed var(--border-color);
    padding: 30px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f9fafb;
}

.file-upload-wrapper:hover {
    border-color: var(--accent-color);
    background: #eff6ff;
}

/* =========================================
   Sidebar Layout System
   ========================================= */
.main-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 40px;
    align-items: start;
    position: relative;
    padding-bottom: 60px;
}

/* Sidebar Navigation */
.category-sidebar {
    position: sticky;
    top: 100px;
    /* Header height + gap */
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.sidebar-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: 15px;
    font-weight: 700;
    padding-left: 10px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary-color);
    transform: translateX(5px);
}

.sidebar-link.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar-link .icon {
    margin-right: 10px;
    font-size: 1.1rem;
}

/* Content Area */
.resource-content {
    min-width: 0;
    /* Prevent grid overflow */
}

/* Section Wrapper refinements */
.section-wrapper {
    margin-top: 0 !important;
    /* Override inline styles */
    margin-bottom: 60px;
    scroll-margin-top: 100px;
    /* For smooth scroll offset */
}

.section-wrapper:last-child {
    margin-bottom: 0;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .category-sidebar {
        position: sticky;
        top: 70px;
        /* Header visible */
        z-index: 90;
        max-height: none;
        overflow-x: auto;
        white-space: nowrap;
        padding: 10px 15px;
        background: rgba(255, 255, 255, 0.9);
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        margin: 0 -20px 20px -20px;
        /* Bleed to edges */
        border-radius: 0;
    }

    .sidebar-nav {
        flex-direction: row;
        width: max-content;
    }

    .sidebar-link {
        flex: 0 0 auto;
        padding: 8px 16px;
        background: rgba(255, 255, 255, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }

    .sidebar-link:hover {
        transform: translateY(-2px);
    }
}