/* ========================================
   공통 스타일 - common.css
   ======================================== */

/* 리셋 & 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #111;
    line-height: 1.6;
}

/* 링크 기본 */
a {
    text-decoration: none;
    color: inherit;
}

/* ========================================
   버튼 공통
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

/* Primary 버튼 (초록색) */
.btn-primary,
.btn.primary {
    background: #009b63;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn.primary:hover {
    background: #007a4d;
}

/* Outline 버튼 */
.btn-outline,
.btn.outline {
    background: #ffffff;
    color: #009b63 !important;
    border: 2px solid #009b63;
}

.btn-outline:hover,
.btn.outline:hover {
    background: #f0fff4;
}

/* Cancel 버튼 */
.btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    background: #ffffff;
    color: #666;
    border: 1px solid #ddd;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #f8f9fa;
    border-color: #999;
    color: #333;
}

/* Submit 버튼 */
.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    background: #009b63;
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-submit:hover {
    background: #007a4d;
}

.btn-submit:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.btn-submit.active {
    background: #009b63;
    cursor: pointer;
}

/* edit, delete 버튼 */
.btn-edit,
.btn-delete {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit {
    background: #ffffff;
    color: #333;
    border: 1px solid #ddd;
}

.btn-edit:hover {
    background: #f0f0f0;
    border-color: #009b63;
    color: #009b63;
}

.btn-delete {
    color: #dc3545;
    background: #ffffff;
    border: 1px solid #ddd;
}

.btn-delete:hover {
    background: #fff5f5;
    border-color: #dc3545;
}

/* Dark 버튼 */
.btn-dark {
    background: #475569;
    color: #ffffff;
    padding: 0 20px;
    height: 48px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-dark:hover {
    background: #334155;
}

/* ========================================
   폼 공통
   ======================================== */

.form-group {
    margin-bottom: 0;
}

.form-label,
.write-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
}

.required {
    color: #ef4444;
    margin-left: 2px;
}

/* 입력 필드 */
.form-input,
.write-input,
input[name="title"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e1e4e8;
    border-radius: 10px;
    font-size: 15px;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-input:focus,
.write-input:focus,
input[name="title"]:focus {
    border-color: #009b63;
}

.form-input::placeholder,
.write-input::placeholder {
    color: #bbb;
}

/* 텍스트 영역 */
.form-textarea,
.write-textarea,
textarea[name="content"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e1e4e8;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
    font-family: inherit;
    box-sizing: border-box;
    min-height: 100px;
}

.form-textarea:focus,
.write-textarea:focus,
textarea[name="content"]:focus {
    outline: none;
    border-color: #009b63;
}

/* 인라인 폼 (중복체크) */
.form-inline {
    display: flex;
    gap: 10px;
}

.form-inline .form-input {
    flex: 1;
}

/* 메시지 */
.form-msg {
    font-size: 12px;
    margin-top: 5px;
    color: #666;
}

/* ========================================
   배지 (Badge)
   ======================================== */

.badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

/* 성공후기 (Green) */
.badge.success {
    background: #e3f6ee;
    color: #059669;
}

/* 레시피 (Blue) */
.badge.recipe {
    background: #e0f2fe;
    color: #0284c7;
}

/* 질문 (Orange) */
.badge.question {
    background: #fff7ed;
    color: #ea580c;
}

/* 정보 (Purple) */
.badge.info {
    background: #f5f3ff;
    color: #7c3aed;
}

/* 자유 (Gray) */
.badge.free {
    background: #f3f4f6;
    color: #4b5563;
}

/* ========================================
   아바타
   ======================================== */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a8e6cf 0%, #56ab91 100%);
    flex-shrink: 0;
}

.avatar.small {
    width: 32px;
    height: 32px;
}

.avatar.large {
    width: 56px;
    height: 56px;
}

.avatar.gray {
    background: #e0e0e0;
}

/* ========================================
   카드
   ======================================== */

.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid #f1f3f5;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* ========================================
   통계 아이템
   ======================================== */

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 14px;
}

.stat-item svg {
    color: #999;
}

/* ========================================
   Alert
   ======================================== */

.alert {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    animation: slideDown 0.3s ease-out;
}

.alert-danger {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-info {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.alert-warning {
    background-color: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   카테고리 버튼
   ======================================== */

.category {
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid #e1e4e8;
    background: #fff;
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category:hover:not(.active) {
    border-color: #009b63;
    color: #009b63;
}

.category.active {
    background: #009b63;
    color: #fff;
    border-color: #009b63;
    font-weight: 700;
}

/* ========================================
   액션 버튼 영역
   ======================================== */

.form-actions,
.write-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* ========================================
   유틸리티
   ======================================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Margin */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* Flex */
.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* ========================================
   반응형
   ======================================== */

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .show-mobile {
        display: none !important;
    }
}