* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.header {
    background: #fff;
    color: #333;
    padding: 25px 30px;
    text-align: center;
    border-bottom: 2px solid #e9ecef;
    position: relative;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.home-button {
    position: absolute;
    top: 25px;
    left: 30px;
    padding: 10px 16px;
    background: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.home-button:hover {
    background: #5a6268;
    text-decoration: none;
    color: white;
}

.nav-button {
    position: absolute;
    top: 25px;
    right: 30px;
    padding: 10px 16px;
    background: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-button:hover {
    background: #1e7e34;
    text-decoration: none;
    color: white;
}

.controls {
    padding: 30px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.date-form {
    display: flex;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn {
    padding: 12px 24px;
    background: #495057;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    background: #343a40;
}

.filter-section {
    background: #fff;
    padding: 15px 30px;
    border-bottom: 1px solid #e2e8f0;
}

.filter-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 15px !important;
    margin-top: 15px !important;
    margin-bottom: 0 !important;
}

.filter-group {
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    padding: 15px !important;
    background: #f8fafc !important;
    margin-bottom: 0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.filter-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #374151;
    font-size: 0.9rem;
}

.dropdown-group {
    position: relative;
}

.dropdown-button {
    width: 100%;
    padding: 12px 16px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-item:hover {
    background: #f8fafc;
}

.stats-header {
    background: #f8fafc;
    padding: 15px 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.toggle-btn:hover {
    background: #5a6268;
}

.stats-grid.hidden {
    display: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding: 30px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
}

.stat-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    border-left: 3px solid;
}

.stat-card.earnings {
    border-left-color: #28a745;
}

.stat-card.requests {
    border-left-color: #17a2b8;
}

.stat-card.clicks {
    border-left-color: #fd7e14;
}

.stat-card.impressions {
    border-left-color: #6c757d;
}

.stat-card.ctr {
    border-left-color: #dc3545;
}

.stat-card.ecpm {
    border-left-color: #6f42c1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    color: #6b7280;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-container {
    padding: 30px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.data-table th {
    background: #495057;
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.sortable:hover {
    background: #5a6268;
}

.sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

.sortable.asc::after {
    content: '\f0de';
    opacity: 1;
}

.sortable.desc::after {
    content: '\f0dd';
    opacity: 1;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.data-table tr:hover {
    background-color: #f8fafc;
}

.data-table tr:nth-child(even) {
    background-color: #fafafa;
}

.currency {
    color: #10b981;
    font-weight: 600;
}

.percentage {
    color: #3b82f6;
    font-weight: 500;
}

.app-id {
    background: #6c757d;
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: help;
    transition: background-color 0.2s ease;
}

.app-id:hover {
    background: #5a6268;
}

.account-name {
    background: #6c757d;
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 600;
}

.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.no-data i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* 태블릿 화면 */
@media (max-width: 1024px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* 모바일 화면 */
@media (max-width: 768px) {
    .date-form {
        flex-direction: column;
    }

    .filter-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 2rem;
    }

    .home-button {
        position: relative;
        top: auto;
        left: auto;
        margin-bottom: 10px;
        margin-right: 10px;
    }

    .nav-button {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 15px;
    }
}

/* 작은 화면에서 더 컴팩트하게 */
@media (max-width: 480px) {
    .filter-group {
        padding: 12px;
    }
    
    .filter-title {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    
    .dropdown-button {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}
