/* 관리자 페이지 공통 스타일 */

* { box-sizing: border-box; }

/* 공통 알림 메시지 스타일 */
.admin-notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.admin-notification-overlay.show {
    opacity: 1;
}

.admin-notification-overlay.hide {
    opacity: 0;
}

.admin-notification-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 35px;
    min-width: 450px;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
    position: relative;
}

.admin-notification-overlay.show .admin-notification-box {
    transform: scale(1) translateY(0);
}

.admin-notification-box.admin-notification-success {
    border-top: 4px solid #28a745;
}

.admin-notification-box.admin-notification-error {
    border-top: 4px solid #dc3545;
}

.admin-notification-box.admin-notification-warning {
    border-top: 4px solid #ffc107;
}

.admin-notification-box.admin-notification-info {
    border-top: 4px solid #0054FF;
}

.admin-notification-box.admin-notification-confirm {
    border-top: 4px solid #ffc107;
}

.notification-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    margin: 0 auto 20px;
    flex-shrink: 0;
}

.notification-icon-success {
    background: #d4edda;
    color: #28a745;
}

.notification-icon-error {
    background: #f8d7da;
    color: #dc3545;
}

.notification-icon-warning {
    background: #fff3cd;
    color: #856404;
}

.notification-icon-info {
    background: #d1ecf1;
    color: #0054FF;
}

.notification-message {
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 25px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.notification-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.notification-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.notification-btn-primary {
    background: #0054FF;
    color: #fff;
}

.notification-btn-primary:hover {
    background: #0040cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 84, 255, 0.3);
}

.notification-btn-secondary {
    background: #6c757d;
    color: #fff;
}

.notification-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.notification-btn:active {
    transform: translateY(0);
}

/* 모바일 반응형 */
@media screen and (max-width: 768px) {
    .admin-notification-box {
        min-width: 90%;
        max-width: 90%;
        padding: 30px 25px;
        margin: 20px;
    }
    
    .notification-icon {
        width: 50px;
        height: 50px;
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    .notification-message {
        font-size: 16px;
        line-height: 1.8;
        margin-bottom: 20px;
        padding: 0 5px;
    }
    
    .notification-buttons {
        flex-direction: column;
    }
    
    .notification-btn {
        width: 100%;
    }
}

body {
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* 사이드바 */
.sidebar {
    width: 250px;
    background: #1a1e27;
    color: #fff;
    min-height: 100vh;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    position: relative;
    padding: 20px;
    background: #0f1217;
    border-bottom: 1px solid #2a2f3a;
    text-align: center;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
}

.sidebar-header img {
    max-width: 150px;
    max-height: 50px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

.mobile-close-btn {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 4px;
    transition: all 0.3s ease;
    z-index: 10001;
}

.mobile-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.sidebar-menu {
    padding: 10px 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.sidebar-menu a {
    display: block;
    padding: 12px 20px;
    color: #b8bcc8;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
    background: #2a2f3a;
    color: #fff;
    border-left-color: #0054FF;
}

.sidebar-menu a.active {
    background: #0054FF;
    color: #fff;
    border-left-color: #0054FF;
}

/* 메인 컨테이너 */
.main-container {
    margin-left: 250px;
    flex: 1;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.top-nav {
    background: #1a1e27;
    padding: 15px 30px;
    border-bottom: 1px solid #2a2f3a;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.top-nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
}

.top-nav-logo {
    display: flex;
    align-items: center;
    height: 50px;
}

.top-nav-logo img {
    max-height: 50px;
    width: auto;
    object-fit: contain;
}

.top-nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
    height: 50px;
}

.admin-info {
    font-size: 14px;
    color: #fff;
    font-weight: 500;
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-nav-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2a2f3a;
    border: 2px solid #3a3f4a;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    flex-shrink: 0;
}

.top-nav-icon-btn:hover {
    background: #3a3f4a;
    border-color: #0054FF;
    transform: scale(1.05);
}

.top-nav-icon-btn:hover svg path {
    fill: #0054FF;
}

.top-nav-icon-btn svg path {
    fill: #fff;
}

.top-nav-icon-btn svg {
    width: 20px;
    height: 20px;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2a2f3a;
    border: 2px solid #ff4d4d;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: #ff4d4d;
    transform: scale(1.05);
}

.logout-btn:hover svg path {
    fill: #fff;
}

.logout-btn svg path {
    fill: #fff;
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

.content-body {
    padding: 30px;
}

/* 테이블 스타일 */
.admin-table-wrap {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: block;
}

/* 모바일 카드 리스트 기본 숨김 (데스크톱) */
.mobile-card-list {
    display: none !important;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background: #f8f9fa;
}

.admin-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: bold;
    color: #333;
    font-size: 13px;
    border-bottom: 2px solid #e0e0e0;
}

.admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #555;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* 제목 칸 최소 너비 설정 */
.admin-table th:nth-child(6),
.admin-table td:nth-child(6) {
    min-width: 200px;
}

.admin-table tbody tr:hover {
    background: #f8f9fa;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr.recent-row {
    background: #fff9e6 !important;
    border-left: 3px solid #ffc107;
}

.admin-table tbody tr.recent-row:hover {
    background: #fff3cd !important;
}

/* 상태 배지 */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    background: #e0e0e0;
    color: #666;
}

.status-badge.status-1 {
    background: #fff3cd;
    color: #856404;
}

.status-badge.status-2 {
    background: #cfe2ff;
    color: #084298;
}

.status-badge.status-3 {
    background: #d1e7dd;
    color: #0f5132;
}

/* 주소 라인 */
.addr-line {
    margin: 3px 0;
    font-size: 12px;
}

.date-tag {
    color: #999;
    font-size: 11px;
}

/* 페이징 */
.paging-wrap {
    text-align: center;
    margin-top: 20px;
}

.paging-btn {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 3px;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    min-width: 35px;
}

.paging-btn:hover {
    background: #f8f9fa;
    border-color: #0054FF;
    color: #0054FF;
}

.paging-btn.active {
    background: #0054FF;
    color: #fff;
    border-color: #0054FF;
}

/* 검색 박스 */
.search-box {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-form-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input-group {
    flex: 1;
    min-width: 200px;
}

.search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #0054FF;
}

.search-button-group {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-primary {
    background: #0054FF;
    color: #fff;
}

.btn-primary:hover {
    background: #0044cc;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-info {
    background: #20c997;
    color: #fff;
}

.btn-info:hover {
    background: #1aa179;
}

/* 모바일 메뉴 오버레이 */
.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* 모바일 메뉴 토글 버튼 (햄버거 아이콘) */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 10000;
    background: #1a1e27;
    color: #fff;
    border: none;
    padding: 12px 10px;
    border-radius: 4px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: #2a2f3a;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* 반응형 - 모바일 (768px 이하) */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-close-btn {
        display: block;
        top: 6px;
        right: 6px;
        width: 30px;
        height: 30px;
        line-height: 30px;
        font-size: 22px;
    }

    .sidebar {
        width: 280px;
        max-width: 85vw;
        position: fixed;
        left: -280px;
        top: 0;
        z-index: 9999;
        transition: left 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-height: 100vh;
        height: 100dvh;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }

    .sidebar-header {
        padding: 8px 10px;
        min-height: 54px;
    }

    .sidebar-header img,
    .sidebar-header a img,
    #adminSidebar .sidebar-header img,
    #adminSidebar .sidebar-header a img {
        max-width: 112px !important;
        max-height: 30px !important;
    }

    .sidebar-menu {
        padding: 0;
        max-height: none;
        overflow: visible;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    }

    .sidebar-menu a {
        padding: 12px 16px;
        font-size: 12px;
        line-height: 1.55;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .main-container {
        margin-left: 0;
        width: 100%;
    }

    .content-body {
        padding: 15px;
    }

    .top-nav {
        padding: 15px 50px 15px 60px;
        font-size: 13px;
    }

    /* 검색 박스 모바일 최적화 */
    .search-box {
        padding: 15px;
    }

    .search-form-row {
        flex-direction: column;
        gap: 10px;
    }

    .search-input-group {
        width: 100%;
        min-width: 100%;
    }

    .search-button-group {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .search-button-group .btn {
        flex: 1;
    }

    /* 테이블 모바일 최적화 - 카드 형태로 변경 */
    .admin-table-wrap {
        display: none !important; /* 모바일에서 테이블 영역 숨김 */
    }
    
    /* 모바일 카드 리스트 */
    .mobile-card-list {
        display: block !important;
        margin-top: 0;
    }
    
    .mobile-card-item {
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 15px;
        margin-bottom: 12px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 84, 255, 0.2);
        transition: background-color 0.2s, box-shadow 0.2s;
    }
    
    .mobile-card-item:active {
        background-color: #f5f5f5;
        box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }
    
    .mobile-card-item.recent-row {
        border-left: 4px solid #28a745;
    }
    
    .mobile-card-item.deleted-row {
        opacity: 0.6;
    }
    
    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        padding-bottom: 10px;
        border-bottom: 1px solid #eee;
    }
    
    .mobile-card-checkbox {
        margin-right: 10px;
    }
    
    .mobile-card-number {
        font-weight: bold;
        color: #0054FF;
        font-size: 14px;
    }
    
    .mobile-card-line1 {
        font-size: 14px;
        font-weight: bold;
        color: #333;
        margin-bottom: 8px;
        line-height: 1.5;
    }
    
    .mobile-card-line2 {
        font-size: 13px;
        color: #666;
        margin-bottom: 8px;
        line-height: 1.5;
    }
    
    .mobile-card-line3 {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 12px;
        color: #999;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid #eee;
    }
    
    .mobile-card-status {
        font-weight: bold;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 11px;
    }
    
    .mobile-card-date {
        color: #999;
    }
    
    /* 검색 입력창 모바일 최적화 */
    .search-input {
        font-size: 13px;
        padding: 8px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
        white-space: nowrap;
    }
    
    /* 출발지(경유지) 컬럼은 줄바꿈 허용 */
    .admin-table th:nth-child(5),
    .admin-table td:nth-child(5) {
        white-space: normal !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        min-width: 220px !important;
        width: 250px !important;
    }

    /* 페이징 모바일 최적화 */
    .paging-btn {
        padding: 6px 10px;
        margin: 2px;
        font-size: 12px;
        min-width: 30px;
    }

    .paging-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 0;
    }
}

/* 데스크톱에서는 모바일 카드 숨김, 테이블 표시 */
@media (min-width: 769px) {
    .mobile-card-list {
        display: none !important;
    }
    
    .admin-table-wrap {
        display: block !important;
    }
    
    .admin-table {
        display: table !important;
    }
}

/* 작은 모바일 (480px 이하) */
@media (max-width: 480px) {
    .mobile-menu-toggle {
        top: 10px;
        left: 10px;
        width: 40px;
        height: 40px;
        padding: 10px 8px;
    }
    
    .mobile-menu-toggle span {
        width: 20px;
        height: 2px;
    }
    
    .sidebar {
        width: 260px;
        max-width: 90vw;
        height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-header {
        padding: 7px 9px;
        min-height: 50px;
    }

    .sidebar-header img,
    .sidebar-header a img,
    #adminSidebar .sidebar-header img,
    #adminSidebar .sidebar-header a img {
        max-width: 104px !important;
        max-height: 27px !important;
    }

    .sidebar-menu {
        padding: 0;
        max-height: none;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
    }

    .sidebar-menu a {
        padding: 11px 14px;
        font-size: 11px;
        line-height: 1.5;
    }
    
    .top-nav {
        padding: 12px 50px 12px 60px;
        font-size: 12px;
    }

    .content-body h2 {
        font-size: 18px;
    }

    .admin-table {
        font-size: 10px;
        min-width: 700px;
    }

    .admin-table th,
    .admin-table td {
        padding: 6px 8px;
    }
    
    /* 작은 모바일에서도 출발지(경유지) 컬럼 최소 너비 보장 */
    .admin-table th:nth-child(5),
    .admin-table td:nth-child(5) {
        min-width: 180px !important;
        white-space: normal !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .status-badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    .search-box {
        padding: 12px;
    }
}

/* 환경설정 탭 메뉴 공통 스타일 */
.config-nav-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
}

.config-nav-tab {
    padding: 8px 16px !important;
    background: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #666 !important;
    text-decoration: none !important;
    white-space: nowrap;
    transition: all 0.3s;
    font-weight: 500;
    display: inline-block !important;
    line-height: 1.4;
    min-height: 36px;
    box-sizing: border-box;
    vertical-align: middle;
}

.config-nav-tab:hover {
    background: #e8e8e8 !important;
    color: #333 !important;
    border-color: #bbb !important;
}

.config-nav-tab.active {
    background: #0054FF !important;
    color: #fff !important;
    border-color: #0054FF !important;
}

.config-nav-tab.active:hover {
    background: #0044cc !important;
    border-color: #0044cc !important;
}

@media (max-width: 768px) {
    .config-nav-tabs {
        gap: 4px;
        padding-bottom: 4px;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }
    .config-nav-tab {
        padding: 6px 10px;
        font-size: 11px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .config-nav-tabs {
        gap: 3px;
        grid-template-columns: repeat(3, 1fr);
    }
    .config-nav-tab {
        padding: 5px 8px;
        font-size: 10px;
    }
}
