/* --- NEW: Font Face Definitions --- */
@font-face {
    font-family: 'KoPubWorld Dotum';
    font-weight: 300; /* Light */
    src: url('../fonts/KoPubWorld Dotum Light.ttf') format('truetype');
}

@font-face {
    font-family: 'KoPubWorld Dotum';
    font-weight: 500; /* Medium */
    src: url('../fonts/KoPubWorld Dotum Medium.ttf') format('truetype');
}

@font-face {
    font-family: 'KoPubWorld Dotum';
    font-weight: 700; /* Bold */
    src: url('../fonts/KoPubWorld Dotum Bold.ttf') format('truetype');
}
/* --- END: Font Face Definitions --- */


/* General and Body Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* UPDATED: Font Family with KoPubWorld Dotum as primary */
    font-family: 'KoPubWorld Dotum', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 500; /* Set Medium as the default weight */
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 50%, #0d1117 100%);
    color: #ffffff;
    min-height: 100vh;
}

/* Container for Centering Content (like Login) */
.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Login Card */
.login-card {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.logo h1 {
    color: #ffffff;
    font-size: 28px;
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700; /* Use Bold font */
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #e1e1e1;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
}

.form-group input:focus {
    outline: none;
    border-color: rgba(70, 130, 180, 0.6);
}

/* Button Styles */
.login-btn, .btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #2c5282 0%, #4682b4 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 700; /* Use Bold font */
    cursor: pointer;
    margin: 10px 0;
    transition: background 0.2s ease-in-out;
}

.login-btn:hover, .btn:hover {
    background: linear-gradient(135deg, #2a4d6b 0%, #3a6d96 100%);
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

.btn-secondary, .btn-success, .btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: white;
    transition: background-color 0.2s ease-in-out;
}

.btn-secondary { background-color: #6b7280; }
.btn-secondary:hover { background-color: #4b5563; }
.btn-success { background-color: #16a085; }
.btn-success:hover { background-color: #138d75; }
.btn-danger { background-color: #e74c3c; }
.btn-danger:hover { background-color: #c0392b; }

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: rgba(20, 20, 20, 0.95);
    border-right: 1px solid rgba(70, 130, 180, 0.3);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    transform: translateX(-250px);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(70, 130, 180, 0.3);
    text-align: center;
}

.sidebar-header h3 {
    color: #ffffff;
    margin: 0;
    font-weight: 700; /* Use Bold font */
    font-size: 20px;
    line-height: 1.4;
}

.sidebar-toggle {
    position: fixed;
    left: 250px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(70, 130, 180, 0.8);
    border: none;
    color: white;
    padding: 10px 8px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 1001;
}

.sidebar.collapsed + .sidebar-toggle {
    left: 0;
}

.sidebar-toggle:hover {
    background: rgba(70, 130, 180, 1);
}

/* Navigation Menu */
.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.nav-item {
    border-bottom: 1px solid rgba(70, 130, 180, 0.2);
}

.nav-link {
    display: block;
    padding: 15px 20px;
    color: #ffffff;
    text-decoration: none;
    transition: background 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(70, 130, 180, 0.2);
}

.nav-link.active {
    background: rgba(70, 130, 180, 0.3);
    border-left: 3px solid #4682b4;
    font-weight: 700; /* Use Bold font */
}

/* Main Content Area */
.main-content {
    transition: margin-left 0.3s ease;
    margin-left: 250px;
    flex: 1;
    padding: 20px;
}

.main-content.expanded {
    margin-left: 0;
}

/* Dashboard & Sections */
.dashboard {
    display: none;
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard:first-of-type {
    display: block;
}

.section-card {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
}

.section-title {
    color: #ffffff;
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 700;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(70, 130, 180, 0.3);
    padding-bottom: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.tab-button {
    padding: 10px 20px;
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 8px 8px 0 0;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: none;
}

.tab-button:hover {
    background: rgba(70, 130, 180, 0.2);
}

.tab-button.active {
    background: rgba(70, 130, 180, 0.4);
    border-color: rgba(70, 130, 180, 0.6);
    border-bottom: 2px solid #4682b4;
    color: #fff;
    font-weight: 700;
}

.add-sheet-btn {
    padding: 10px 15px;
    background: rgba(70, 130, 180, 0.3);
    border: 1px solid rgba(70, 130, 180, 0.5);
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.add-sheet-btn:hover {
    background: rgba(70, 130, 180, 0.5);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* File Upload Section */
.upload-section {
    background: rgba(25, 25, 25, 0.8);
    border: 2px dashed rgba(70, 130, 180, 0.4);
    border-radius: 8px;
    padding: 30px;
    margin: 20px 0;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-section:hover {
    border-color: rgba(70, 130, 180, 0.6);
    background: rgba(35, 35, 35, 0.9);
}

.upload-section.drag-over {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    transform: scale(1.02);
}

.file-input {
    display: none;
}

.file-label {
    display: inline-block;
    background: linear-gradient(135deg, #2c5282 0%, #4682b4 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    margin-bottom: 10px;
}

.file-label:hover {
    background: linear-gradient(135deg, #2a4d6b 0%, #3a6d96 100%);
}

.drag-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    margin-top: 10px;
}

.error-message {
    color: #ff6b6b;
    font-size: 14px;
    text-align: center;
    margin-top: 10px;
}

/* Date Input Style */
input[type="date"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 40px;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.8;
    padding-left: 10px;
}

/* Results Table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    overflow-x: auto;
    display: block;
}

.results-table table {
    width: 100%;
    min-width: 1200px;
}

.results-table th,
.results-table td {
    border: 1px solid rgba(70, 130, 180, 0.3);
    padding: 12px 15px;
    text-align: left;
    white-space: nowrap;
}

/* NEW: Style for material name cell */
.material-name-cell {
    font-family: monospace;
    font-size: 12px; /* Increased font size */
}

.results-table th {
    background: rgba(70, 130, 180, 0.2);
    font-weight: 700;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
}

.results-table th:hover {
    background: rgba(70, 130, 180, 0.3);
}

.sort-indicator {
    display: inline-block;
    margin-left: 5px;
    font-size: 12px;
    opacity: 0.7;
}

.roas-good { color: #4ade80; font-weight: 700; }
.roas-average { color: #fbbf24; font-weight: 700; }
.roas-poor { color: #f87171; font-weight: 700; }


/* --- UPDATED: Metric Card Styles for Single Row --- */
.metrics-grid {
    display: grid;
    /* Create 8 equal columns, they will wrap if space is not enough */
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.metric-card {
    background: rgba(25, 25, 25, 0.7);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 8px;
    padding: 12px; /* Reduced padding */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 5px; /* Reduced gap */
    transition: all 0.3s ease;
    border-left: 3px solid #4682b4; /* Default accent color */
    min-height: 80px; /* Set a min-height for consistency */
}
.metric-card:hover {
    transform: translateY(-3px);
    background: rgba(35, 35, 35, 0.9);
    border-color: rgba(70, 130, 180, 0.6);
}
.metric-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px; /* Reduced font size */
    color: #a0aec0; /* Lighter text for the label */
    font-weight: 500;
}
.metric-card-icon {
    font-size: 14px; /* Reduced icon size */
    opacity: 0.7;
}
.metric-card-value {
    font-size: 20px; /* Reduced value size */
    font-weight: 700;
    color: #ffffff;
    text-align: right;
}
/* Color accents for specific metrics */
.metric-card.clicks { border-left-color: #a78bfa; }
.metric-card.cpc { border-left-color: #f6ad55; }
.metric-card.ctr { border-left-color: #48bb78; }
.metric-card.cost { border-left-color: #f56565; }
.metric-card.conversions { border-left-color: #38b2ac; }
.metric-card.revenue { border-left-color: #4ade80; }
.metric-card.roas { border-left-color: #ed8936; }
.metric-card.cvr { border-left-color: #9f7aea; }
/* --- END: Updated Metric Card Styles --- */


/* Filter Sections */
.filter-section, .saved-data-section {
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.filter-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group input, .filter-group select {
    padding: 10px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
}

/* Crawling Data Analysis */
.crawling-textarea {
    width: 100%;
    min-height: 300px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 8px;
    color: #ffffff;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
}

.crawling-textarea:focus {
    outline: none;
    border-color: rgba(70, 130, 180, 0.6);
}

.account-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.account-checkbox {
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.account-checkbox:hover {
    background: rgba(70, 130, 180, 0.2);
}

.account-checkbox.active {
    background: rgba(70, 130, 180, 0.4);
    border-color: #4682b4;
    font-weight: 700;
}

/* --- NEW: AI Analysis Section Styles --- */
.ai-analysis-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
}
.ai-section-title {
    font-weight: 700;
    color: #a0aec0;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(70, 130, 180, 0.3);
    padding-bottom: 10px;
}
.prompt-textarea {
    width: 100%;
    min-height: 250px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 8px;
    color: #ffffff;
    padding: 15px;
    font-family: 'KoPubWorld Dotum', sans-serif;
    font-size: 14px;
    resize: vertical;
}
.prompt-textarea:focus {
    outline: none;
    border-color: rgba(70, 130, 180, 0.6);
}
.markdown-body {
    background: rgba(20,20,20,0.5);
    padding: 20px;
    border-radius: 8px;
    line-height: 1.7;
}
/* --- END: AI Analysis Section Styles --- */


/* Footer */
.footer {
    background: rgba(20, 20, 20, 0.95);
    border-top: 1px solid rgba(70, 130, 180, 0.3);
    padding: 30px;
    text-align: center;
    margin-top: 50px;
    width: 100%;
}

.footer h3 {
    color: #ffffff;
    margin-bottom: 15px;
}

.footer p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.footer a {
    color: #4682b4;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Debug Info Box */
.debug-info {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 350px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    font-family: monospace;
    color: #00ff00;
    font-size: 11px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

/* Logout Button */
.logout-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(220, 20, 60, 0.8);
    border: none;
    border-radius: 6px;
    color: white;
    padding: 10px 20px;
    cursor: pointer;
    z-index: 1002;
    transition: background-color 0.2s;
}
.logout-btn:hover {
    background-color: rgba(200, 20, 60, 1);
}

/* Save Dialog & Overlay */
.save-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 30, 30, 0.98);
    border: 1px solid rgba(70, 130, 180, 0.5);
    border-radius: 12px;
    padding: 30px;
    z-index: 2000;
    display: none;
    min-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.save-dialog h3 {
    color: #ffffff;
    margin-bottom: 20px;
}

.save-dialog input {
    width: 100%;
    padding: 10px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 6px;
    color: #ffffff;
    margin-bottom: 20px;
}

.save-dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1999;
    display: none;
}

/* Media/Crawling Input Sections */
.media-input-section {
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.media-input-group {
    border: 1px solid rgba(70, 130, 180, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    background: rgba(25, 25, 25, 0.5);
}

.media-input-group .grid-pair {
    display: grid;
    gap: 15px;
    margin-bottom: 10px;
    align-items: center;
}

.media-input-group .grid-pair:last-child {
    margin-bottom: 0;
}

.media-input-group .grid-name-patterns {
    grid-template-columns: 1fr 2fr;
}

.media-input-group .grid-cost-cpc {
    grid-template-columns: 1fr 1fr;
}

.media-input-group input[type="text"],
.media-input-group input[type="number"] {
    width: 100%;
    padding: 10px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    box-sizing: border-box;
}

.media-input-group input:focus {
    outline: none;
    border-color: rgba(70, 130, 180, 0.6);
}

.media-input-group label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin-bottom: 5px;
}

.add-media-btn {
    background: rgba(70, 130, 180, 0.4);
    border: 1px solid rgba(70, 130, 180, 0.6);
    border-radius: 6px;
    color: white;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
}

.add-media-btn:hover {
    background: rgba(70, 130, 180, 0.6);
}

/* Responsive Styles */
@media (max-width: 1200px) {
    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}


@media (max-width: 768px) {
    .filter-group,
    .media-input-group .grid-name-patterns,
    .media-input-group .grid-cost-cpc,
    .metrics-grid,
    .ai-analysis-container {
        grid-template-columns: 1fr;
    }

    .debug-info {
        width: calc(100% - 20px);
        max-width: 280px;
        font-size: 10px;
        bottom: 5px;
        right: 5px;
    }

    .sidebar {
        width: 200px;
    }
    .sidebar.collapsed {
        transform: translateX(-200px);
    }
    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }
    .sidebar-toggle {
        left: 200px;
    }
    .sidebar.collapsed + .sidebar-toggle {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    .login-card, .section-card {
        padding: 25px;
    }
    
    .results-table {
        font-size: 12px;
    }
    .results-table th, .results-table td {
        padding: 8px;
    }
    .results-table table {
        min-width: 800px;
    }
    
    .metric-card {
        padding: 15px;
    }
    .metric-card-value {
        font-size: 20px;
    }
    .metric-card-header {
        font-size: 12px;
    }
}
@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr; /* 1 card per row on small mobile */
    }
}
/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #4682b4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingText {
    color: #ffffff;
    margin-top: 20px;
    font-size: 16px;
}

/* Main Header */
.main-header {
    position: fixed;
    top: 0;
    left: 250px;
    right: 0;
    height: 60px;
    background: rgba(30, 30, 30, 0.95);
    border-bottom: 1px solid rgba(70, 130, 180, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    transition: left 0.3s ease;
}

.sidebar.collapsed ~ .main-header {
    left: 0;
}

.user-info {
    color: #ffffff;
    font-size: 14px;
}

.user-info strong {
    color: #4682b4;
}

/* Sidebar toggle button adjustment */
.main-header .sidebar-toggle {
    position: relative;
    left: 0;
    top: 0;
    transform: none;
    margin-right: 20px;
}

/* Main content adjustment for header */
.main-content {
    padding-top: 80px; /* Add space for fixed header */
}

/* Form actions */
.form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.form-actions button {
    width: 100%;
}

/* Subtitle in login */
.login-card .subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    text-align: center;
    margin-top: -20px;
    margin-bottom: 20px;
}

/* Sidebar header update */
.sidebar-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    margin-top: 5px;
}

/* Logout button position update */
.logout-btn {
    position: relative;
    top: 0;
    right: 0;
}
/* style.css에 추가할 스타일 */

/* Form footer for login/signup toggle */
.form-footer {
    text-align: center;
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.form-footer a {
    color: #4682b4;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.form-footer a:hover {
    color: #5a9fd4;
    text-decoration: underline;
}

/* Error message styling update */
.error-message {
    color: #ff6b6b;
    font-size: 14px;
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 6px;
    display: none;
}

/* Success message for signup */
.success-message {
    color: #4ade80;
    font-size: 14px;
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 6px;
    display: none;
}

/* AI 보고서 스타일 */
.ai-report-container {
    background: white;
    color: #333;
    padding: 40px;
    border-radius: 8px;
    max-width: 210mm; /* A4 width */
    margin: 0 auto;
    font-family: 'KoPubWorld Dotum', 'Noto Sans KR', sans-serif;
    line-height: 1.6;
}

.report-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #4682b4;
}

.report-header h2 {
    color: #2c5282;
    font-size: 24px;
    margin-bottom: 10px;
}

.report-period {
    color: #666;
    font-size: 16px;
}

.report-section {
    margin-bottom: 30px;
    page-break-inside: avoid;
}

.report-section h3 {
    color: #2c5282;
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e0e0e0;
}

.ai-summary {
    background: #f5f7fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #4682b4;
}

.insights-list,
.anomaly-list,
.recommendations-list {
    list-style: none;
    padding: 0;
}

.insights-list li,
.anomaly-list li,
.recommendations-list li {
    background: #f9f9f9;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    position: relative;
    padding-left: 35px;
}

.insights-list li::before {
    content: "💡";
    position: absolute;
    left: 12px;
    top: 12px;
}

.anomaly-list li::before {
    content: "⚠️";
    position: absolute;
    left: 12px;
    top: 12px;
}

.recommendations-list li::before {
    content: "✅";
    position: absolute;
    left: 12px;
    top: 12px;
}

.metrics-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 14px;
}

.metrics-table th,
.metrics-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.metrics-table th {
    background-color: #f0f4f8;
    color: #2c5282;
    font-weight: 600;
}

.metrics-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.metrics-table tr:hover {
    background-color: #f0f4f8;
}

/* 백업 이력 테이블 스타일 */
.backup-history-table {
    width: 100%;
    overflow-x: auto;
    margin-top: 15px;
}

.backup-history-table table {
    width: 100%;
    border-collapse: collapse;
}

.backup-history-table th,
.backup-history-table td {
    border: 1px solid rgba(70, 130, 180, 0.3);
    padding: 10px;
    text-align: left;
}

.backup-history-table th {
    background: rgba(70, 130, 180, 0.2);
    font-weight: 600;
}

.backup-history-table tr:hover {
    background: rgba(70, 130, 180, 0.1);
}

/* 작은 버튼 스타일 */
.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-sm.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-sm.btn-danger:hover {
    background-color: #c0392b;
}

/* 일별 백업 섹션 */
.daily-backup-section {
    background: rgba(20, 20, 20, 0.6);
    border-radius: 8px;
    padding: 20px;
}

/* 커스텀 상품명 입력 */
#customProductName {
    width: 100%;
    padding: 10px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(70, 130, 180, 0.3);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
}

/* PDF 생성 시 스타일 */
@media print {
    .ai-report-container {
        padding: 20mm;
        margin: 0;
        background: white;
        color: black;
    }
    
    .btn-group {
        display: none;
    }
    
    .report-section {
        page-break-inside: avoid;
    }
}

/* AI 보고서 매체 정보 스타일 추가 */
.report-media {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
}

/* 매체별 성과 테이블을 위한 추가 스타일 */
#mediaMetricsContainer {
    margin-bottom: 20px;
}

#mediaMetricsContainer h4 {
    color: #2c5282;
    font-size: 16px;
    margin-bottom: 10px;
}

/* AI 보고서 매체 정보 스타일 추가 */
.report-media {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
}

/* 매체별 성과 테이블을 위한 추가 스타일 */
#mediaMetricsContainer {
    margin-bottom: 20px;
}

#mediaMetricsContainer h4 {
    color: #2c5282;
    font-size: 16px;
    margin-bottom: 10px;
}

/* 보고서 섹션의 select 요소가 비활성화되지 않도록 명시 */
#reportMediaSelect {
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    background-color: rgba(20, 20, 20, 0.8) !important;
}