/* ============================================
   AptGo Responsive CSS - PC & Mobile 최적화
   ============================================ */

/* ---- Base Reset & Touch Optimization ---- */
* {
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

/* Touch-friendly minimum tap target */
button, .btn, a.list-group-item, .nav-link {
    min-height: 44px;
    min-width: 44px;
}

/* ---- Responsive Tables → Mobile Card Layout ---- */
.table-mobile-cards {
    width: 100%;
}

@media (max-width: 767.98px) {
    /* 테이블 → 카드 변환 */
    .table-mobile-cards thead {
        display: none;
    }

    .table-mobile-cards tbody tr {
        display: block;
        background: #fff;
        border: 1px solid #e9ecef;
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 12px 16px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    }

    .table-mobile-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        font-size: 0.9rem;
    }

    .table-mobile-cards tbody td:last-child {
        border-bottom: none;
        padding-top: 10px;
        justify-content: flex-end;
        gap: 6px;
    }

    .table-mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #495057;
        margin-right: 12px;
        flex-shrink: 0;
        font-size: 0.85rem;
    }

    /* 모바일에서 숨길 컬럼 */
    .table-mobile-cards .mobile-hide {
        display: none !important;
    }
}

/* ---- Sidebar → Mobile Collapsible ---- */
@media (max-width: 767.98px) {
    .sidebar-col {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        background: #fff;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
        transition: left 0.3s ease;
        overflow-y: auto;
        padding-top: 60px;
    }

    .sidebar-col.show {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1040;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .content-col {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Sidebar toggle button (mobile only) */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1060;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
    font-size: 1.3rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

@media (max-width: 767.98px) {
    .sidebar-toggle {
        display: flex;
    }
}

/* ---- Navigation Responsive ---- */
@media (max-width: 767.98px) {
    .navbar {
        padding: 8px 12px;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .navbar-nav .nav-link {
        padding: 10px 0;
        font-size: 0.95rem;
    }
}

/* ---- Cards Responsive ---- */
@media (max-width: 767.98px) {
    .card {
        margin-bottom: 12px;
    }

    .card-body {
        padding: 16px;
    }

    .card-header {
        padding: 12px 16px;
    }
}

/* ---- Form Responsive ---- */
@media (max-width: 767.98px) {
    .form-control, .form-select {
        font-size: 16px !important; /* iOS 줌 방지 */
        padding: 10px 14px;
    }

    .input-group {
        flex-wrap: wrap;
    }

    /* 검색/필터 폼 세로 배치 */
    .filter-row .col-md-2,
    .filter-row .col-md-3,
    .filter-row .col-md-4,
    .filter-row .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 8px;
    }
}

/* ---- Button Group Responsive ---- */
@media (max-width: 767.98px) {
    .btn-group {
        flex-wrap: wrap;
        gap: 4px;
    }

    .btn-group .btn {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    /* 관리 버튼 세로 배치 */
    .management-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .management-buttons .btn {
        flex: 1 1 auto;
        min-width: 60px;
    }
}

/* ---- Modal Responsive ---- */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 8px;
        max-width: calc(100% - 16px);
    }

    .modal-body {
        padding: 16px;
        max-height: 70vh;
        overflow-y: auto;
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1;
    }
}

/* ---- Typography Responsive ---- */
@media (max-width: 767.98px) {
    h1, .h1 { font-size: 1.6rem; }
    h2, .h2 { font-size: 1.4rem; }
    h3, .h3 { font-size: 1.2rem; }
    h4, .h4 { font-size: 1.1rem; }
    h5, .h5 { font-size: 1rem; }

    .display-4 {
        font-size: 1.8rem;
    }
}

/* ---- Stats Card Responsive ---- */
@media (max-width: 575.98px) {
    .stat-card, .dashboard-card {
        padding: 16px;
        min-height: auto;
    }

    .stat-card h2, .stat-card h3 {
        font-size: 1.5rem;
    }

    .stat-card .stat-icon {
        font-size: 2rem;
    }
}

/* ---- Page Header Responsive ---- */
@media (max-width: 767.98px) {
    .page-header {
        padding: 1rem 0;
        margin: 0 0 1rem 0;
    }

    .page-header h2 {
        font-size: 1.3rem;
    }
}

/* ---- Landing / Pricing Page ---- */
@media (max-width: 767.98px) {
    .landing-nav {
        padding: 12px 16px !important;
        gap: 0 !important;
    }

    .landing-nav .nav-links {
        gap: 16px !important;
        font-size: 0.85rem;
    }

    .hero-section h1 {
        font-size: 1.8rem !important;
    }

    .hero-section p {
        font-size: 1rem !important;
    }

    .hero-section {
        min-height: 60vh !important;
        padding: 40px 16px !important;
    }

    /* Pricing 3-column → 1-column */
    .pricing-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

/* ---- Post Detail 2-column → 1-column ---- */
@media (max-width: 767.98px) {
    .main-content {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .main-content .sidebar-content {
        order: -1;
    }
}

/* ---- Board Post Items ---- */
@media (max-width: 767.98px) {
    .post-item {
        padding: 10px 0;
    }

    .post-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .post-title-inline {
        min-width: auto !important;
        max-width: none !important;
    }
}

/* ---- Complaint Flow (가로 유지) ---- */
@media (max-width: 767.98px) {
    .complaint-flow-container {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: center;
        gap: 0.15rem;
    }

    .complaint-flow-container .flow-arrow {
        transform: none;
        flex: 0 0 auto;
    }
}

/* ---- Utility: Mobile Show/Hide ---- */
@media (max-width: 767.98px) {
    .desktop-only { display: none !important; }
}

@media (min-width: 768px) {
    .mobile-only { display: none !important; }
}

/* ---- Spacing Adjustments ---- */
@media (max-width: 767.98px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .row {
        margin-left: -6px;
        margin-right: -6px;
    }

    .row > * {
        padding-left: 6px;
        padding-right: 6px;
    }

    .mb-4 { margin-bottom: 1rem !important; }
    .mt-4 { margin-top: 1rem !important; }
    .p-4 { padding: 1rem !important; }
    .py-5 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
}

/* ---- Print Styles ---- */
@media print {
    .sidebar-col, .sidebar-toggle, .sidebar-overlay,
    .navbar, .btn, .modal { display: none !important; }

    .content-col { width: 100% !important; max-width: 100% !important; }
}
