@import 'tailwindcss';

@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';

@theme {
    --font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
        'Segoe UI Symbol', 'Noto Color Emoji';
}

/* ตั้งค่าพื้นฐานสำหรับ Dashboard */
.smart-dashboard {
    background-color: #f8fafc;
    /* สีพื้นหลังสว่างแบบแอพ Smart Home */
    min-height: 100vh;
    padding: 2rem 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.header-title p {
    margin: 0.25rem 0 0 0;
    color: #64748b;
    font-size: 0.9rem;
}

/* แถบสรุปสถานะด้านบน */
.status-bar {
    display: flex;
    gap: 1rem;
    background: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.dot-active {
    background-color: #10b981;
}

/* ตะแกรง Grid สำหรับการ์ด */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* การ์ดอุปกรณ์ */
.device-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid #f1f5f9;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.device-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* ส่วนหัวของการ์ด (ไอคอน + สวิตช์) */
.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.device-icon {
    width: 40px;
    height: 40px;
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-icon svg {
    width: 20px;
    height: 20px;
}

/* สวิตช์เปิด-ปิดจำลอง */
.toggle-switch {
    width: 44px;
    height: 24px;
    background-color: #0ea5e9;
    border-radius: 12px;
    position: relative;
    transition: background-color 0.2s;
}

.toggle-switch.is-off {
    background-color: #cbd5e1;
}

.toggle-switch.is-offline {
    background-color: #e2e8f0;
    opacity: 0.6;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    right: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.toggle-switch.is-off::after,
.toggle-switch.is-offline::after {
    right: auto;
    left: 2px;
}

/* แท็ก (Tags) */
.card-tags {
    display: flex;
    gap: 0.5rem;
}

.tag {
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 8px;
}

/* ข้อมูลอุปกรณ์ */
.card-info h4 {
    margin: 0;
    font-size: 1.1rem;
    color: #0f172a;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.card-info p {
    margin: 0;
    font-size: 0.8rem;
    color: #64748b;
}

/* สถานะว่าง */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 16px;
    border: 2px dashed #e2e8f0;
    color: #64748b;
}

.empty-state a {
    display: inline-block;
    margin-top: 1rem;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
}
/* กลุ่มอุปกรณ์ตามประเภท */
.device-group + .device-group {
    margin-top: 2rem;
}

.device-group-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.device-group-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: #1e293b;
}

.device-group-count {
    font-size: 0.875rem;
    color: #64748b;
    white-space: nowrap;
}
