@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;700&family=Chakra+Petch:wght@300;400;500;700&display=swap');

:root {
    /* Main Colors */
    --primary-color: #0ff;
    --primary-light: #5fffff;
    --primary-dark: #00c0c0;
    --accent-color: #ff00a0;
    --accent-glow: rgba(255, 0, 160, 0.5);
    --success-color: #00ff9d;
    --warning-color: #ffbb00;
    --danger-color: #ff3860;
    
    /* Background Colors */
    --dark-bg: #080819;
    --card-bg: #0c0c22;
    --card-bg-hover: #13133a;
    --input-bg: #1a1a3a;
    
    /* Text Colors */
    --text-light: #f0f0ff;
    --text-medium: #b0b0cc;
    --text-muted: #7a7a9d;
    
    /* Effects */
    --neon-shadow: 0 0 5px rgba(0, 255, 255, 0.2), 
                   0 0 10px rgba(0, 255, 255, 0.1);
    --accent-shadow: 0 0 5px rgba(255, 0, 160, 0.2), 
                     0 0 10px rgba(255, 0, 160, 0.1);
    --card-shadow: 0 8px 16px rgba(0, 0, 0, 0.4),
                   0 0 0 1px rgba(20, 20, 40, 0.6);
}

body {
    font-family: 'Chakra Petch', 'Prompt', sans-serif;
    background-color: var(--dark-bg);
    background-image: 
        radial-gradient(circle at 80% 20%, rgba(5, 5, 40, 0.8) 0%, rgba(0, 0, 0, 0) 70%),
        radial-gradient(circle at 20% 80%, rgba(20, 0, 40, 0.8) 0%, rgba(0, 0, 0, 0) 70%);
    background-attachment: fixed;
    padding: 20px;
    margin: 0;
    color: var(--text-medium);
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(transparent, transparent 2px, rgba(0, 255, 255, 0.03) 2px, rgba(0, 255, 255, 0.03) 4px);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 25px;
    color: var(--text-medium);
    border-top: 2px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--primary-color) 50%, 
        transparent 100%);
    animation: scanline 4s linear infinite;
    z-index: 1;
}

@keyframes scanline {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* User Interface and Authentication */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    padding-bottom: 15px;
    position: relative;
}

.header-container::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--primary-color), 
        transparent);
}

h1 {
    color: var(--text-light);
    margin: 0;
    position: relative;
    font-weight: 500;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

h1::before {
    content: '//';
    color: var(--primary-color);
    margin-right: 10px;
    font-weight: 300;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-medium);
    font-size: 14px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 255, 0.2);
}

#logout-button {
    background-color: rgba(255, 0, 160, 0.2);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Chakra Petch', 'Prompt', sans-serif;
    transition: all 0.3s;
    font-weight: 500;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

#logout-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        rgba(255, 0, 160, 0.2),
        rgba(255, 0, 160, 0)
    );
    transform: rotate(45deg);
    z-index: -1;
    transition: all 0.3s;
}

#logout-button:hover {
    background-color: rgba(255, 0, 160, 0.3);
    box-shadow: var(--accent-shadow);
    transform: translateY(-1px);
}

#logout-button:hover::before {
    transform: rotate(45deg) translateY(50px);
}

h2 {
    color: var(--text-light);
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
    padding: 5px 0;
    font-weight: 500;
    letter-spacing: 0.5px;
}

h2::before {
    content: '[';
    color: var(--primary-color);
    margin-right: 10px;
}

h2::after {
    content: ']';
    color: var(--primary-color);
    margin-left: 10px;
}

h3 {
    color: var(--text-light);
    margin-top: 30px;
    margin-bottom: 10px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.stats-container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(12, 12, 34, 0.7);
    border-radius: 8px;
    box-shadow: var(--neon-shadow);
    padding: 25px;
    flex: 1;
    min-width: 250px;
    transition: all 0.3s;
    border: 1px solid rgba(0, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.stat-card:hover::after {
    transform: translateX(0);
}

.stat-card:nth-child(2) {
    border-color: rgba(255, 0, 160, 0.1);
}

.stat-card:nth-child(2)::after {
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    border-color: rgba(0, 255, 255, 0.3);
}

.stat-card:nth-child(2):hover {
    border-color: rgba(255, 0, 160, 0.3);
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    margin: 10px 0;
    transition: all 0.3s;
}

.stat-card:nth-child(2) .stat-value {
    color: var(--accent-color);
    text-shadow: 0 0 5px rgba(255, 0, 160, 0.5);
}

.stat-card:hover .stat-value {
    transform: scale(1.05);
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    box-shadow: var(--neon-shadow);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(20, 20, 50, 0.3);
    border: 1px solid rgba(0, 255, 255, 0.1);
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 255, 255, 0.1);
}

th {
    background-color: rgba(0, 0, 0, 0.5);
    color: var(--primary-color);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 14px;
    position: relative;
}

tr {
    background-color: rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s;
}

tr:nth-child(even) {
    background-color: rgba(20, 20, 50, 0.2);
}

tr:hover {
    background-color: rgba(0, 255, 255, 0.05);
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: var(--text-muted);
    position: relative;
}

.loading::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 20px auto 0;
    border: 3px solid transparent;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s ease-in-out infinite;
}

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

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    border: 1px dashed rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    margin: 20px 0;
    position: relative;
}

.empty-state::before {
    content: 'NO DATA';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(0, 255, 255, 0.05);
    font-size: 60px;
    font-weight: bold;
    z-index: -1;
    letter-spacing: 5px;
}

.timestamp {
    color: var(--text-muted);
    font-size: 12px;
    text-align: right;
    margin-top: 20px;
    font-style: italic;
    font-family: 'Chakra Petch', monospace;
}

canvas#dailyClicksChart {
    margin-top: 20px;
    max-width: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.1);
}

/* Date Filter Container */
.date-filter-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    background: rgba(8, 8, 30, 0.6);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--neon-shadow);
    border: 1px solid rgba(0, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.date-filter-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
}

.date-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    flex: 1;
}

.date-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    min-width: 200px;
    position: relative;
}

.date-field label {
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-medium);
    letter-spacing: 0.5px;
    font-weight: 500;
}

.date-field input[type="date"] {
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    font-family: 'Chakra Petch', 'Prompt', sans-serif;
    background-color: rgba(10, 10, 30, 0.9);
    color: white;
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

/* ปรับไอคอนปฏิทินให้เป็นสีขาวและเห็นชัดเจน */
.date-field input[type="date"]::-webkit-calendar-picker-indicator {
    background-color: transparent;
    filter: invert(1) brightness(5) contrast(2); /* เพิ่มความสว่างและความคมชัดสูงสุด */
    opacity: 1; /* เพิ่มความทึบแสงให้เห็นชัดเจน */
    width: 24px;
    height: 24px;
    cursor: pointer;
    padding: 2px;
    margin-right: 2px;
    transition: all 0.3s;
}

/* เอฟเฟกต์เมื่อโฮเวอร์ที่ไอคอน */
/* วิธีแก้ไขไอคอนปฏิทินแบบเข้มข้น */

/* 1. ใช้ box-shadow สีขาวรอบไอคอนปฏิทิน */
.date-field input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(10) contrast(5) !important; /* เพิ่มความสว่างสูงสุดและความคมชัด */
    opacity: 1 !important;
    width: 28px !important;
    height: 28px !important;
    cursor: pointer !important;
    padding: 4px !important;
    margin-right: 0 !important;
    background-color: rgba(255, 255, 255, 0.2) !important; /* เพิ่มพื้นหลังสีขาวโปร่งแสง */
    border-radius: 50% !important; /* ทำให้พื้นหลังเป็นวงกลม */
    box-shadow: 0 0 0 1px white, 0 0 5px 2px rgba(255, 255, 255, 0.8) !important; /* เพิ่มกรอบสีขาวและเรืองแสง */
}

/* 2. เปลี่ยนรูปแบบช่องกรอกวันที่ทั้งหมด */
.date-field input[type="date"] {
    padding-right: 40px !important; /* เพิ่มที่ว่างด้านขวาสำหรับไอคอน */
    padding-left: 15px !important;
    border: 2px solid white !important; /* เพิ่มขอบสีขาวชัดเจน */
    border-radius: 6px !important;
    background-color: rgba(0, 0, 20, 0.9) !important; /* พื้นหลังเข้มขึ้น */
    color: white !important;
    font-size: 16px !important;
}

/* 3. เพิ่มไอคอนปฏิทินเองด้วย CSS */
.date-field {
    position: relative !important;
}

.date-field::after {
    content: ""; /* ใช้ emoji ปฏิทิน */
    position: absolute !important;
    right: 12px !important;
    top: 65% !important;
    transform: translateY(-50%) !important;
    font-size: 22px !important;
    color: white !important;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8) !important;
    pointer-events: none !important; /* ทำให้คลิกทะลุผ่านไปได้ */
    z-index: 2 !important;
}

/* 4. ปรับแต่งขอบเขตที่คลิกได้ให้ใหญ่ขึ้น */
.date-field input[type="date"]::-webkit-clear-button,
.date-field input[type="date"]::-webkit-inner-spin-button {
    display: none !important;
}

/* 5. ปิดการแสดงปุ่มลบวันที่ (ถ้ามี) */
.date-field input[type="date"]::-webkit-clear-button {
    display: none !important;
}

.filter-button {
    background-color: rgba(0, 255, 255, 0.1);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Chakra Petch', 'Prompt', sans-serif;
    transition: all 0.3s;
    align-self: flex-end;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.filter-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle,
        rgba(0, 255, 255, 0.2) 0%,
        transparent 70%
    );
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.3s;
}

.filter-button:hover {
    background-color: rgba(0, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--neon-shadow);
}

.filter-button:hover::after {
    opacity: 1;
    transform: scale(1);
}

.filter-button.reset {
    background-color: rgba(150, 150, 150, 0.1);
    border-color: #666;
    color: #aaa;
}

.filter-button.reset:hover {
    background-color: rgba(150, 150, 150, 0.2);
    border-color: #888;
    color: #ccc;
}

.filtered-data-notice {
    background-color: rgba(0, 255, 255, 0.05);
    border-left: 2px solid var(--primary-color);
    padding: 12px 20px;
    margin-bottom: 20px;
    color: var(--text-medium);
    font-size: 14px;
    border-radius: 0 4px 4px 0;
    position: relative;
    font-family: 'Chakra Petch', monospace;
}

.filtered-data-notice::before {
    content: 'FILTER';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    opacity: 0.5;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background: rgba(8, 8, 30, 0.6);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 10px;
    border: 1px solid rgba(0, 255, 255, 0.1);
}

.pagination-info {
    color: var(--text-muted);
    font-size: 14px;
    font-family: 'Chakra Petch', monospace;
}

.pagination-controls {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.pagination-button {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 255, 255, 0.2);
    color: var(--text-medium);
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    font-family: 'Chakra Petch', 'Prompt', sans-serif;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.pagination-button:hover:not([disabled]) {
    background-color: rgba(0, 255, 255, 0.1);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.pagination-button.active {
    background-color: rgba(0, 255, 255, 0.2);
    color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: var(--neon-shadow);
}

.pagination-button[disabled] {
    cursor: not-allowed;
    opacity: 0.5;
    background-color: rgba(0, 0, 0, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        align-items: center;
    }
    
    .pagination-info {
        margin-bottom: 10px;
    }
    
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .stats-container {
        flex-direction: column;
    }
    
    .stat-card {
        width: 100%;
    }
    
    .date-inputs {
        flex-direction: column;
    }
    
    .date-field {
        width: 100%;
    }
}