/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* 헤더 */
.header {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2rem;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 버튼 스타일 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: linear-gradient(135deg, #03c75a 0%, #00e676 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(3, 199, 90, 0.4);
}

.btn-danger {
    background: #ff4757;
    color: white;
}

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

.btn-edit {
    background: #ffa502;
    color: white;
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-edit:hover {
    background: #ff8c00;
}

/* 필터 섹션 */
.filter-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #666;
}

.filter-select,
.filter-input {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    min-width: 150px;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #667eea;
}

/* 요약 카드 */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.card-icon.meta {
    background: linear-gradient(135deg, #3b5998 0%, #8b9dc3 100%);
}

.card-icon.naver {
    background: linear-gradient(135deg, #03c75a 0%, #00e676 100%);
}

.card-icon.total {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-icon.conversion {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

.card-content h3 {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 5px;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

/* 차트 섹션 */
.chart-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.chart-container h2 {
    font-size: 1.25rem;
    color: #333;
    margin-bottom: 20px;
}

.chart-wrapper {
    position: relative;
    height: 400px;
    width: 100%;
}

.chart-wrapper canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

/* 테이블 섹션 */
.table-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.table-section h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
}

.table-wrapper {
    overflow-x: auto;
    margin-bottom: 20px;
}

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

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
}

td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.875rem;
}

tbody tr:hover {
    background: #f9f9f9;
}

.platform-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.platform-badge.meta {
    background: #e3f2fd;
    color: #3b5998;
}

.platform-badge.naver {
    background: #e8f5e9;
    color: #03c75a;
}

/* 페이지네이션 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.page-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.page-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 25px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

/* 폼 스타일 */
form {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .filter-section {
        flex-direction: column;
    }

    .filter-select,
    .filter-input {
        width: 100%;
    }

    .chart-section {
        grid-template-columns: 1fr;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.75rem;
    }

    th, td {
        padding: 10px 8px;
    }

    .chart-wrapper {
        height: 300px;
    }
}

/* 로딩 상태 */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #ddd;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 1rem;
}

/* 파일 업로드 모달 */
.upload-content {
    padding: 25px;
}

.upload-info {
    background: #f0f7ff;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    border-radius: 8px;
}

.upload-info i {
    font-size: 1.5rem;
    color: #667eea;
    margin-top: 5px;
}

.upload-info h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #333;
}

.upload-info p {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 5px;
    line-height: 1.5;
}

.upload-info strong {
    color: #333;
}

.file-upload-area {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.file-upload-area:hover {
    border-color: #667eea;
    background: #f5f7ff;
}

.file-upload-area.drag-over {
    border-color: #667eea;
    background: #e8eeff;
    transform: scale(1.02);
}

.file-upload-area i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 15px;
    display: block;
}

.file-upload-area p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 5px;
}

.file-upload-area .file-types {
    font-size: 0.875rem;
    color: #999;
}

.upload-preview {
    margin-top: 20px;
}

.upload-preview h3 {
    font-size: 1.125rem;
    color: #333;
    margin-bottom: 15px;
}

.file-info {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.file-info i {
    font-size: 1.5rem;
    color: #667eea;
}

.file-info span {
    font-size: 0.875rem;
    color: #666;
}

.preview-table-wrapper {
    margin-bottom: 20px;
}

.preview-table-wrapper p {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 10px;
}

.preview-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    overflow-x: auto;
    display: block;
}

.preview-table-wrapper th,
.preview-table-wrapper td {
    padding: 8px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.preview-table-wrapper th {
    background: #f5f5f5;
    font-weight: 600;
}

.upload-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

