/* Custom Styles for Ad Dashboard */

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Sidebar Styles */
.sidebar-active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.8) 0%, rgba(59, 130, 246, 0) 100%);
    border-left: 3px solid #fff;
}

/* DataTables Custom Styling */
#reportTable_wrapper {
    padding: 0;
}

/* 検索ボックスを左端に配置 */
.dataTables_wrapper .dataTables_filter {
    float: left !important;
    text-align: left !important;
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_info {
    float: right !important;
    padding-top: 0.5rem;
}

#reportTable {
    border-collapse: collapse;
    width: 100% !important;
}

#reportTable thead th {
    background-color: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 500;
    white-space: nowrap;
}

#reportTable tbody tr {
    transition: background-color 0.15s ease;
}

#reportTable tbody tr:hover {
    background-color: #f0f7ff;
}

#reportTable tbody td {
    vertical-align: middle;
    padding: 12px 12px;
    border-bottom: 1px solid #f3f4f6;
}

/* Thumbnail Image Styles */
.thumbnail-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.thumbnail-placeholder {
    width: 50px;
    height: 50px;
    background-color: #f3f4f6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 10px;
}

/* Ad Name Cell Styles */
.ad-name-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ad-name {
    font-weight: 500;
    color: #1f2937;
    font-size: 13px;
    line-height: 1.4;
}

.ad-campaign {
    font-size: 11px;
    color: #6b7280;
}

.ad-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.ad-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
}

/* Label Cell Styles */
.label-cell {
    max-width: 200px;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.4;
}

.tag-cafe {
    background-color: #fef3c7;
    color: #92400e;
}

.tag-instagram {
    background-color: #fce7f3;
    color: #be185d;
}

.tag-facebook {
    background-color: #dbeafe;
    color: #1e40af;
}

.tag-google {
    background-color: #dcfce7;
    color: #166534;
}

.tag-yahoo {
    background-color: #fee2e2;
    color: #991b1b;
}

.tag-twitter {
    background-color: #e0f2fe;
    color: #0369a1;
}

.tag-line {
    background-color: #d1fae5;
    color: #065f46;
}

.tag-default {
    background-color: #f3f4f6;
    color: #4b5563;
}

/* Performance Indicator Styles */
.performance-up {
    color: #059669;
    display: flex;
    align-items: center;
    gap: 2px;
}

.performance-down {
    color: #dc2626;
    display: flex;
    align-items: center;
    gap: 2px;
}

.performance-neutral {
    color: #6b7280;
}

/* Number formatting */
.number-cell {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.currency {
    color: #1f2937;
}

.percentage {
    color: #4b5563;
}

/* Footer row */
#reportTable tfoot tr {
    background-color: #eff6ff;
}

#reportTable tfoot td {
    font-weight: 600;
    color: #1e40af;
    padding: 14px 12px;
    border-top: 2px solid #3b82f6;
}

/* Flatpickr Custom Styles */
.flatpickr-calendar {
    font-family: 'Noto Sans JP', sans-serif;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.startRange.prevMonthDay,
.flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.startRange.nextMonthDay,
.flatpickr-day.endRange.nextMonthDay {
    background: #2563eb;
    border-color: #2563eb;
}

.flatpickr-day.inRange {
    background: #dbeafe;
    border-color: #dbeafe;
    box-shadow: none;
}

/* DataTables Pagination */
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #eff6ff !important;
    border-color: #dbeafe !important;
    color: #1e40af !important;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 12px;
    margin-left: 8px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 8px;
    margin: 0 8px;
}

.dataTables_info {
    color: #6b7280;
    font-size: 13px;
}

/* Summary Card Styles */
.summary-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive Adjustments */
@media (max-width: 1280px) {
    #reportTable {
        font-size: 12px;
    }

    #reportTable tbody td,
    #reportTable thead th {
        padding: 10px 8px;
    }

    .thumbnail-img,
    .thumbnail-placeholder {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 1024px) {
    .summary-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Print Styles */
@media print {
    aside {
        display: none;
    }

    main {
        margin-left: 0 !important;
    }

    header {
        position: relative !important;
    }

    .shadow-sm {
        box-shadow: none !important;
    }
}

/* Loading State */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Tooltip Styles */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 500;
}

.status-active {
    background-color: #dcfce7;
    color: #166534;
}

.status-paused {
    background-color: #fef3c7;
    color: #92400e;
}

.status-ended {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* =================================
   Breadcrumb Navigation Styles
   ================================= */

.breadcrumb-container {
    background: linear-gradient(to right, #f8fafc, #f1f5f9);
    border-bottom: 1px solid #e2e8f0;
    padding: 0.875rem 1.5rem;
    position: sticky;
    top: 64px; /* ヘッダーの下に固定 */
    z-index: 30;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: 0.875rem;
    align-items: center;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid #94a3b8;
    border-top: 1.5px solid #94a3b8;
    transform: rotate(45deg);
    margin: 0 0.75rem;
}

.breadcrumb-item a {
    color: #3b82f6;
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
}

.breadcrumb-item a:hover {
    color: #1d4ed8;
    background-color: rgba(59, 130, 246, 0.1);
}

.breadcrumb-item.active {
    color: #475569;
    font-weight: 600;
    background: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* =================================
   Drilldown Link Styles
   ================================= */

.drilldown-link {
    color: #3b82f6;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s ease;
}

.drilldown-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* テーブル行のホバー効果（ドリルダウン可能な行） */
tr.drilldown-row {
    cursor: pointer;
}

tr.drilldown-row:hover {
    background-color: #f1f5f9 !important;
}

/* ドリルダウンアイコン */
.drilldown-icon {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.15s ease;
}

.drilldown-link:hover .drilldown-icon {
    transform: translateX(2px);
    color: #3b82f6;
}
