/**
 * EzNet v5.0 - Common Stylesheet
 * 모든 페이지에서 공통으로 사용하는 스타일
 */

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Malgun Gothic", sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    word-wrap: break-word;
    word-break: keep-all;
    overflow-wrap: break-word;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

a:hover {
    color: #0066cc;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ============================================
   Container
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    overflow: visible;
}

/* ============================================
   Main Content
   ============================================ */
.site-main {
    flex: 1;
    padding: 2rem 0;
}

/* Page Title */
.page-title {
    text-align: center;
    margin-bottom: 2rem;
}

.page-title h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.page-title p {
    color: #666;
    font-size: 1rem;
}

/* ============================================
   Forms
   ============================================ */
.form-container {
    max-width: 500px;
    margin: 0 auto;
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #0066cc;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group small {
    display: block;
    margin-top: 0.3rem;
    color: #666;
    font-size: 0.875rem;
}

/* Form Buttons */
.btn {
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    width: 100%;
    padding: 0.875rem;
    background: #0066cc;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.btn-primary:hover {
    background: #0052a3;
}

.btn-secondary {
    width: 100%;
    padding: 0.875rem;
    background: #6c757d;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 4px;
    transition: background 0.3s ease;
}

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

/* Form Links */
.form-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.form-footer a {
    color: #0066cc;
    font-size: 0.9rem;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* ============================================
   Messages (Success, Error, Info)
   ============================================ */
.message {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    font-size: 0.95rem;
}

.message-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.message-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.message-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.message-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-center {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.card-header {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e0e0e0;
}

.card-body {
    color: #555;
}

/* 주문 정보 카드 테이블 기본 스타일 */
.card table td {
    padding: 0.5rem;
}

.card table td:last-child {
    text-align: right;
}

/* ============================================
   Tables
   ============================================ */
.table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

table thead {
    background: #f5f5f5;
}

table th,
table td {
    padding: 0.875rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

table th {
    font-weight: 600;
    color: #333;
}

table tbody tr:hover {
    background: #f9f9f9;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

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

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

.badge-shipped {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-delivered {
    background: #d4edda;
    color: #155724;
}

.badge-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.badge-approved {
    background: #d4edda;
    color: #155724;
}

.badge-rejected {
    background: #f8d7da;
    color: #721c24;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }

    .container {
        padding: 0 15px;
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }

    .site-main {
        padding: 1.5rem 0;
    }

    .page-title h1 {
        font-size: 1.75rem;
    }

    .form-container {
        padding: 1.5rem;
    }

    .card {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
        box-sizing: border-box;
        max-width: 100%;
    }

    .card-center {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }

    .card-header {
        font-size: 1.2rem;
    }

    /* 주문 정보 테이블 반응형 */
    .card table {
        width: 100% !important;
        table-layout: fixed !important;
        box-sizing: border-box;
    }

    .card table td {
        padding: 0.5rem 0.4rem !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        box-sizing: border-box;
        vertical-align: middle;
    }

    .card table td:first-child {
        width: 30% !important;
        font-size: 0.9rem !important;
        text-align: left !important;
        padding-right: 0.6rem !important;
    }

    .card table td:last-child {
        width: 70% !important;
        font-size: 0.95rem !important;
        text-align: right !important;
        padding-left: 0.6rem !important;
    }

    /* 테이블 가로 스크롤 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    /* 버튼 크기 조정 */
    .btn {
        padding: 0.5rem 1.2rem;
        font-size: 0.95rem;
    }

    /* Input group 스택 */
    .input-group {
        flex-wrap: wrap;
    }

    .input-group .form-control {
        min-width: 200px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }

    .container {
        padding: 0 5px;
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }

    .site-main {
        padding: 1rem 0;
    }

    .page-title h1 {
        font-size: 1.5rem;
    }

    .page-title p {
        font-size: 0.9rem;
    }

    .form-container {
        padding: 1rem;
        border-radius: 6px;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-group label {
        font-size: 0.95rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.65rem;
        font-size: 0.95rem;
    }

    .card {
        padding: 0.6rem 0.3rem;
        margin-bottom: 1rem;
        border-radius: 6px;
        box-sizing: border-box;
        max-width: 100%;
    }

    .card-center {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }

    .card-header {
        font-size: 1rem;
        margin-bottom: 0.6rem;
        padding-bottom: 0.5rem;
    }

    /* 주문 정보 테이블 모바일 반응형 */
    .card table {
        width: 100% !important;
        table-layout: fixed !important;
        box-sizing: border-box;
    }

    .card table td {
        padding: 0.4rem 0 !important;
        font-size: 0.8rem !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        box-sizing: border-box;
        vertical-align: middle;
        line-height: 1.4;
    }

    .card table td:first-child {
        width: 28% !important;
        text-align: left !important;
        padding-left: 0 !important;
        padding-right: 0.3rem !important;
    }

    .card table td:last-child {
        width: 72% !important;
        text-align: right !important;
        padding-left: 0.3rem !important;
        padding-right: 0 !important;
    }

    /* 테이블 개선 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    table {
        min-width: 500px;
        font-size: 0.875rem;
    }

    table th,
    table td {
        padding: 0.5rem 0.375rem;
        font-size: 0.85rem;
    }

    table th {
        font-size: 0.8rem;
    }

    /* 버튼 */
    .btn {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }

    .btn-primary,
    .btn-secondary {
        padding: 0.75rem;
        font-size: 0.95rem;
    }

    /* Input Group 모바일 최적화 */
    .input-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .input-group .form-control {
        width: 100%;
        min-width: unset;
    }

    .input-group .btn {
        width: 100%;
        padding: 0.75rem;
    }

    /* Badge */
    .badge {
        padding: 0.2rem 0.6rem;
        font-size: 0.8rem;
    }

    /* Message */
    .message {
        padding: 0.875rem;
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* ============================================
   Input Group Styles
   ============================================ */
.form-control {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #0066cc;
}

.form-control:read-only {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.input-group .form-control {
    flex: 1;
}

.input-group .btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.75rem 1.5rem;
}

.input-group .btn-primary {
    width: auto;
}

.input-group .btn-success {
    width: auto;
    background: #28a745;
    color: #fff;
}

.input-group .btn-success:hover {
    background: #218838;
}
