/**
 * 모아팜 커스텀 스타일
 * Tailwind CDN 환경에서 사용
 */

/* 기본 입력 필드 스타일 */
.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 1rem;
    background-color: #ffffff;
    color: #1f2937;
    transition: all 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: #4a9a2d;
    box-shadow: 0 0 0 3px rgba(74, 154, 45, 0.1);
}

.input-field::placeholder {
    color: #9ca3af;
}

.input-field:disabled,
.input-field[readonly] {
    background-color: #f9fafb;
    color: #6b7280;
    cursor: not-allowed;
}

/* select 스타일 */
select.input-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
}

/* textarea 스타일 */
textarea.input-field {
    min-height: 100px;
    resize: vertical;
}

textarea.input-field.resize-none {
    resize: none;
}

/* 체크박스/라디오 스타일 */
input[type="checkbox"],
input[type="radio"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: #2d5016;
    cursor: pointer;
}

/* 버튼 공통 스타일 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-full {
    width: 100%;
}

/* Primary 버튼 */
.btn-primary {
    background-color: #2d5016;
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background-color: #264512;
}

/* Secondary 버튼 */
.btn-secondary {
    background-color: #8b4513;
    color: #ffffff;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #7a3d10;
}

/* Accent 버튼 */
.btn-accent {
    background-color: #ff6b35;
    color: #ffffff;
}

.btn-accent:hover:not(:disabled) {
    background-color: #f54b10;
}

/* 카카오 버튼 */
.btn-kakao {
    background-color: #FEE500;
    color: #000000;
}

.btn-kakao:hover:not(:disabled) {
    background-color: #FDD800;
}

/* 네이버 버튼 */
.btn-naver {
    background-color: #03C75A;
    color: #ffffff;
}

.btn-naver:hover:not(:disabled) {
    background-color: #02b351;
}

/* 아웃라인 버튼 */
.btn-outline {
    background-color: transparent;
    border: 1px solid #e5e7eb;
    color: #374151;
}

.btn-outline:hover:not(:disabled) {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

/* 카드 스타일 */
.card {
    background-color: #ffffff;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* 뱃지 스타일 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-green {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-orange {
    background-color: #ffedd5;
    color: #c2410c;
}

.badge-gray {
    background-color: #f3f4f6;
    color: #4b5563;
}

.badge-red {
    background-color: #fee2e2;
    color: #dc2626;
}

/* 수확 시기 태그 */
.harvest-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #ff6b35;
    background-color: #fff4ed;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

/* 가격 표시 */
.price {
    font-size: 1.125rem;
    font-weight: 700;
    color: #2d5016;
}

.price-small {
    font-size: 0.875rem;
    font-weight: 600;
    color: #2d5016;
}

/* 거리 표시 */
.distance {
    font-size: 0.75rem;
    color: #6b7280;
}

/* 섹션 타이틀 */
.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1rem;
}

/* 리스트 아이템 */
.list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #f9fafb;
}

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

/* 폼 라벨 */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

/* 폼 에러 메시지 */
.form-error {
    font-size: 0.875rem;
    color: #dc2626;
    margin-top: 0.25rem;
}

/* 이미지 업로드 영역 */
.upload-area {
    border: 2px dashed #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-area:hover {
    border-color: #4a9a2d;
    background-color: #f0f7ec;
}

/* 스켈레톤 로딩 */
.skeleton {
    background-color: #e5e7eb;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    border-radius: 0.25rem;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 빈 상태 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
    color: #9ca3af;
}

/* 스크롤바 커스텀 */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 모바일 탭 효과 */
@media (hover: none) {
    .tap-highlight {
        -webkit-tap-highlight-color: rgba(45, 80, 22, 0.1);
    }
}

/* 안전 영역 패딩 (iOS 노치) */
@supports (padding: max(0px)) {
    .safe-area-bottom {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* 페이드 인 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* 슬라이드 업 애니메이션 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

/* 모달 오버레이 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-content {
    background-color: #ffffff;
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
}

/* 로딩 스피너 */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #dcefd1;
    border-top-color: #2d5016;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 토스트 메시지 */
.toast {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 50;
}

/* 숨김 클래스 */
.hidden {
    display: none !important;
}

/* 에러 상태 input */
.input-field.border-red-500 {
    border-color: #ef4444;
}

.input-field.border-red-500:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* 별점 스타일 */
.rating-star {
    color: #d1d5db;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.rating-star:hover {
    transform: scale(1.1);
}

.rating-star.active .star-empty {
    display: none;
}

.rating-star.active .star-filled {
    display: inline;
    color: #f59e0b;
}

.rating-star:hover .star-empty {
    display: none;
}

.rating-star:hover .star-filled {
    display: inline;
    color: #f59e0b;
}

/* 텍스트 말줄임 */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 스크롤바 숨기기 */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 수평 스크롤 영역 */
.overflow-x-auto {
    overflow-x: auto;
}

/* flex-shrink-0 */
.flex-shrink-0 {
    flex-shrink: 0;
}

/* whitespace-pre-line */
.whitespace-pre-line {
    white-space: pre-line;
}
