/* Code Development View - Project-based Layout */
.code-dev-container {
    display: flex;
    height: 100%;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

/* ===================================
   Sidebar (프로젝트 리스트)
   =================================== */
.cd-sidebar {
    width: 400px;
    min-width: 400px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cd-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--card-border);
}

.cd-sidebar-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cd-project-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.cd-no-projects {
    padding: 20px 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

.cd-project-section-header {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--glass-panel);
    margin-top: 8px;
    border-left: 3px solid transparent;
}

.cd-project-section-header:first-child {
    margin-top: 0;
}

.cd-project-section-header.type-qv-basic {
    border-left-color: var(--accent-green);
}

.cd-project-section-header.type-웹페이지 {
    border-left-color: var(--accent-blue);
}

.cd-project-section-header.type-android {
    border-left-color: var(--accent-orange);
}

.cd-project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 6px;
    margin: 2px 8px;
}

.cd-project-item:hover {
    background: var(--glass-panel-hover);
}

.cd-project-item.active {
    background: var(--glass-panel-hover);
}

.cd-project-item.active.type-qv-basic {
    background: rgba(52, 199, 89, 0.25);
}

.cd-project-item.active.type-웹페이지 {
    background: rgba(0, 122, 255, 0.25);
}

.cd-project-item.active.type-android {
    background: rgba(255, 149, 0, 0.25);
}

.cd-project-item-name {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cd-project-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cd-project-type {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    font-weight: 500;
    background: white;
}

.cd-project-type.type-qv-basic {
    color: var(--accent-green);
}

.cd-project-type.type-웹페이지 {
    color: var(--accent-blue);
}

.cd-project-type.type-android {
    color: var(--accent-orange);
}

.cd-project-item-ver {
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--glass-panel);
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    margin-left: 8px;
}

/* ===================================
   Main Content Area
   =================================== */
.cd-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.cd-main-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.cd-main-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.cd-main-empty p {
    font-size: 14px;
}

.cd-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px;
}

/* Project Header */
.cd-project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.cd-project-info {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.cd-project-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.cd-project-type-badge {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--glass-panel);
    padding: 4px 8px;
    border-radius: 6px;
}

.cd-project-version {
    font-size: 12px;
    color: var(--accent-blue);
    background: rgba(0, 122, 255, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

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

/* Tabs Row */
.cd-tabs-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 12px;
}

.code-dev-tabs {
    display: flex;
    gap: 4px;
}

.cd-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.cd-tab:hover {
    color: var(--text-primary);
    background: var(--glass-panel);
}

.cd-tab.active {
    color: var(--text-primary);
    background: var(--glass-panel-hover);
}

/* Content Area */
.code-dev-content {
    flex: 1;
    overflow-y: auto;
    background: var(--card-bg);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--card-border);
}

/* ===================================
   Buttons
   =================================== */
.cd-btn-primary {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.cd-btn-primary:hover {
    filter: brightness(1.1);
}

.cd-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.cd-btn-secondary:hover {
    background: var(--glass-panel);
    color: var(--text-primary);
}

.cd-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}

.cd-icon-btn:hover {
    background: var(--glass-panel-hover);
    color: var(--text-primary);
}

.cd-icon-btn.danger:hover {
    background: rgba(255, 87, 87, 0.15);
    color: #ff5757;
}

/* ===================================
   Stats Row
   =================================== */
.cd-stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
}

.cd-stat {
    font-size: 12px;
    color: var(--text-secondary);
}

.cd-stat strong {
    color: var(--text-primary);
    margin-left: 4px;
}

.cd-stat.open strong {
    color: var(--accent-pink);
}

.cd-stat.done strong {
    color: var(--accent-green);
}

/* ===================================
   List & Items
   =================================== */
.cd-list {
    display: flex;
    flex-direction: column;
}

.cd-list.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 8px;
}

.cd-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.cd-list-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--divider-soft);
    transition: background 0.1s;
}

.notes-grid .cd-list-item {
    border-bottom: none;
}

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

.cd-list-item:hover {
    background: var(--glass-panel);
}

.notes-grid .cd-list-item:hover {
    background: transparent;
}

.cd-item-check {
    padding-top: 2px;
}

.cd-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-blue);
}

.cd-item-body {
    flex: 1;
    min-width: 0;
}

.cd-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.cd-item-title.done {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.cd-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.cd-item-meta {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.cd-item-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.cd-list-item:hover .cd-item-actions {
    opacity: 1;
}

/* ===================================
   Tags
   =================================== */
.cd-tag {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
    margin-right: 4px;
}

.severity-minor {
    background: var(--glass-panel-hover);
    color: var(--text-secondary);
}

.severity-major {
    background: rgba(255, 149, 0, 0.2);
    color: var(--accent-orange);
}

.severity-critical {
    background: rgba(255, 45, 85, 0.2);
    color: var(--accent-pink);
}

/* ===================================
   Version Items
   =================================== */
.version-item {
    padding: 12px 8px;
}

.version-item .cd-item-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cd-version-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cd-version-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--glass-panel-hover);
    color: var(--text-secondary);
}

.cd-version-badge.latest {
    background: rgba(52, 199, 89, 0.2);
    color: var(--accent-green);
}

.cd-version-date {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.cd-version-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.cd-version-notes {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-line;
    margin-top: 4px;
    padding: 8px;
    background: var(--glass-panel);
    border-radius: 4px;
}

/* ===================================
   Log Items
   =================================== */
.log-item {
    padding: 12px 8px;
}

.cd-log-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.cd-log-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--glass-panel);
    padding: 2px 8px;
    border-radius: 4px;
}

.cd-log-title {
    font-family: "Pretendard", sans-serif;
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}

.cd-log-content {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-line;
}

/* ===================================
   Form Overlay
   =================================== */
.cd-form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.cd-form {
    background: var(--overlay-solid);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 24px;
    width: 95%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-soft);
}

.cd-form h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.cd-form input[type="text"],
.cd-form input[type="date"],
.cd-form input[type="number"],
.cd-form textarea,
.cd-form select {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
}

.cd-form input:focus,
.cd-form textarea:focus,
.cd-form select:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: var(--input-bg-hover);
}

.cd-form textarea {
    resize: vertical;
    min-height: 120px;
}

.cd-version-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.cd-version-prefix,
.cd-version-dot {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
}

.cd-version-inputs input[type="number"] {
    width: 80px;
    margin-bottom: 0;
    text-align: center;
}

/* Note (Post-it) Style */
.note-card {
    background: linear-gradient(135deg, #fff8c5 0%, #fff0a8 100%);
    border: 1px solid #f1d97a;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    width: 300px;
    min-width: 300px;
    height: 300px;
    padding: 12px;
    gap: 6px;
    border-radius: 10px;
    flex-direction: column;
    justify-content: space-between;
}

.note-card .cd-log-header {
    margin-bottom: 8px;
}

.note-card .cd-log-date,
.note-card .cd-log-title {
    color: #3b2f05;
}

.cd-notes-search input {
    padding: 6px 10px;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-primary);
    min-width: 180px;
}

.cd-note-project {
    margin-top: auto;
    font-size: 11px;
    color: #5a4a10;
    background: rgba(0,0,0,0.05);
    padding: 4px 6px;
    border-radius: 6px;
    display: inline-block;
}

.cd-note-content {
    font-family: "Pretendard", sans-serif;
    font-size: 0.8125rem;
    color: rgba(109, 104, 84, 1);
    line-height: 1.6;
    word-break: break-word;
}

.cd-note-content strong {
    font-weight: 700;
}

.cd-note-content em {
    font-style: italic;
}

.cd-note-content mark {
    background: #ffe066;
    padding: 0 2px;
}

.cd-form select {
    cursor: pointer;
}

.cd-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

/* ===================================
   Responsive Layout - CodeDev
   =================================== */

/* CodeDev Sidebar Toggle Button */
.cd-sidebar-toggle {
    display: none;
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.2s ease;
}

.cd-sidebar-toggle:hover {
    background: var(--glass-panel-hover);
}

.cd-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cd-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Tablet/Small Desktop (1200px and below) */
@media screen and (max-width: 1200px) {
    .cd-sidebar-toggle {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .cd-sidebar {
        position: fixed;
        left: -400px;
        top: 0;
        bottom: 0;
        width: 400px;
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }

    .cd-sidebar.active {
        left: 0;
    }

    .cd-main {
        width: 100%;
    }

    .cd-main-content {
        padding-top: 60px;
    }
}

/* Mobile/Small Tablet (700px and below) */
@media screen and (max-width: 700px) {
    .cd-sidebar {
        width: 320px;
        left: -320px;
    }

    .cd-sidebar.active {
        left: 0;
    }

    .cd-main-content {
        padding: 50px 12px 12px;
    }

    /* Adjust project header */
    .cd-project-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .cd-project-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Stack tabs and add button */
    .cd-tabs-row {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .code-dev-tabs {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    /* Adjust notes grid */
    .cd-list.notes-grid {
        grid-template-columns: 1fr;
    }

    /* Form adjustments */
    .cd-form {
        width: 95%;
        padding: 20px;
    }

    .cd-form-actions {
        flex-direction: column;
    }

    .cd-form-actions button {
        width: 100%;
    }
}

/* Mobile (400px and below) */
@media screen and (max-width: 400px) {
    .cd-sidebar {
        width: 100%;
        left: -100%;
    }

    .cd-sidebar.active {
        left: 0;
    }

    .cd-sidebar-toggle {
        top: 8px;
        left: 8px;
        padding: 4px 8px;
        font-size: 14px;
    }

    .cd-main-content {
        padding: 45px 8px 8px;
    }

    /* Compact project items */
    .cd-project-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .cd-project-meta {
        width: 100%;
        justify-content: flex-start;
    }

    /* Compact version inputs */
    .cd-version-inputs {
        flex-wrap: wrap;
    }

    .cd-version-inputs input[type="number"] {
        width: 60px;
    }

    /* Single column stats */
    .cd-stats-row {
        flex-direction: column;
        gap: 8px;
    }

    /* Compact list items */
    .cd-list-item {
        flex-direction: column;
        gap: 8px;
    }

    .cd-item-actions {
        width: 100%;
        justify-content: flex-end;
        opacity: 1;
    }

    /* Smaller note cards */
    .note-card {
        width: 100%;
        min-width: unset;
        height: auto;
        min-height: 200px;
    }
}
