/**
 * SmartThings - Estilos Específicos
 * Design modular e organizado para a plataforma SmartThings
 */

/* ========== GRID SMARTTHINGS ========== */
.smartthings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* ========== CARDS SMARTTHINGS ========== */
.smartthings-card {
    background: linear-gradient(135deg, rgba(10, 22, 40, 0.95), rgba(5, 11, 20, 0.95));
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.smartthings-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00d4ff, #0088ff);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.smartthings-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.6);
}

.smartthings-card:hover::before {
    opacity: 1;
}

/* ========== CABEÇALHO DO CARD ========== */
.smartthings-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.smartthings-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.smartthings-status-online {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.smartthings-status-offline {
    background: rgba(255, 107, 26, 0.15);
    color: #ff6b1a;
    border: 1px solid rgba(255, 107, 26, 0.3);
}

/* ========== INFORMAÇÕES DO DISPOSITIVO ========== */
.smartthings-device-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.smartthings-device-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

.smartthings-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.smartthings-info-label {
    color: #00d4ff;
    font-weight: 600;
    min-width: 80px;
}

/* ========== CONTROLES DO DISPOSITIVO ========== */
.smartthings-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 212, 255, 0.2);
}

.smartthings-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.smartthings-btn-primary {
    background: linear-gradient(135deg, #00d4ff, #0088ff);
    color: white;
}

.smartthings-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.4);
}

.smartthings-btn-secondary {
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.smartthings-btn-secondary:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: rgba(0, 212, 255, 0.5);
}

.smartthings-btn-refresh {
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
    min-width: 40px;
    transition: all 0.3s ease;
}

.smartthings-btn-refresh:hover:not(:disabled) {
    background: rgba(0, 212, 255, 0.2);
    border-color: rgba(0, 212, 255, 0.5);
    transform: translateY(-2px);
}

.smartthings-btn-refresh:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.smartthings-btn-refresh.refreshing {
    background: rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.6);
    color: #00d4ff;
}

.smartthings-btn-refresh.success {
    background: rgba(0, 255, 136, 0.2);
    border-color: rgba(0, 255, 136, 0.5);
    color: #00ff88;
}

.smartthings-btn-refresh.error {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.5);
    color: #ff6b6b;
}

@keyframes rotate-refresh {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.smartthings-btn-refresh.refreshing .refresh-icon {
    animation: rotate-refresh 1s linear infinite;
    display: inline-block;
}

/* ========== CAPACIDADES DO DISPOSITIVO ========== */
.smartthings-capabilities {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.smartthings-capability-tag {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

/* ========== LOADING E ESTADOS VAZIOS ========== */
.smartthings-loading {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.smartthings-loading-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: smartthings-pulse 2s ease-in-out infinite;
}

@keyframes smartthings-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

.smartthings-empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.smartthings-empty h3 {
    font-size: 24px;
    margin: 0 0 10px 0;
}

.smartthings-empty p {
    font-size: 14px;
    opacity: 0.8;
}

/* ========== INFO BOX ========== */
.smartthings-info-box {
    margin-top: 30px;
    padding: 20px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    display: inline-block;
}

.smartthings-info-box p {
    margin: 0;
    font-size: 14px;
    color: #00d4ff;
    line-height: 1.6;
}

.smartthings-info-box a {
    color: #00d4ff;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.smartthings-info-box a:hover {
    color: #33f3ff;
}

/* ========== RESPONSIVIDADE MOBILE ========== */
@media (max-width: 768px) {
    .smartthings-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .room-filter-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .smartthings-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .smartthings-card {
        padding: 16px;
    }
    
    .smartthings-device-name {
        font-size: 16px;
    }
    
    .smartthings-controls {
        flex-direction: column;
    }
    
    .smartthings-btn {
        width: 100%;
    }
    
    .smartthings-filters-container {
        padding: 16px !important;
    }
    
    .smartthings-filters-container h3 {
        font-size: 14px !important;
    }
    
    .smartthings-action-buttons {
        width: 100%;
        justify-content: stretch;
    }
    
    .smartthings-action-buttons button {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .page-title-smartthings {
        font-size: 20px !important;
    }
    
    .page-icon-smartthings {
        width: 48px !important;
        height: 48px !important;
    }
    
    .room-filter-btn {
        padding: 5px 8px;
        font-size: 11px;
        border-radius: 6px;
    }
    
    .smartthings-btn {
        padding: 7px 10px;
        font-size: 12px;
    }
    
    .smartthings-card {
        padding: 14px;
        border-radius: 12px;
    }
    
    .smartthings-device-name {
        font-size: 15px;
    }
    
    .smartthings-device-info {
        font-size: 12px;
    }
    
    .smartthings-room-badge {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .smartthings-filters-container {
        padding: 12px !important;
        border-radius: 12px !important;
    }
    
    .smartthings-filters-container h3 {
        font-size: 12px !important;
        margin-bottom: 8px !important;
    }
    
    #roomFilters {
        gap: 6px !important;
    }
    
    /* Estat\u00edsticas mais compactas */
    .stat-card {
        padding: 8px !important;
    }
    
    .stat-card > div:first-child {
        font-size: 9px !important;
        margin-bottom: 2px !important;
    }
    
    .stat-card > div:last-child {
        font-size: 16px !important;
    }
}

/* ========== ANIMAÇÕES ========== */
@keyframes smartthings-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.smartthings-card {
    animation: smartthings-fade-in 0.4s ease-out;
}

.smartthings-card:nth-child(1) { animation-delay: 0ms; }
.smartthings-card:nth-child(2) { animation-delay: 50ms; }
.smartthings-card:nth-child(3) { animation-delay: 100ms; }
.smartthings-card:nth-child(4) { animation-delay: 150ms; }
.smartthings-card:nth-child(5) { animation-delay: 200ms; }
.smartthings-card:nth-child(6) { animation-delay: 250ms; }

/* ========== FILTROS DE CÔMODOS ========== */
.room-filter-btn {
    padding: 7px 12px;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.25);
    color: #00d4ff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.room-filter-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.4);
    transform: translateY(-2px);
}

.room-filter-btn.active {
    background: rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.6);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

/* ========== BADGE DE CÔMODO NO CARD ========== */
.smartthings-room-badge {
    padding: 6px 12px;
    background: rgba(255, 159, 74, 0.15);
    border: 1px solid rgba(255, 159, 74, 0.35);
    color: #ff9f4a;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.smartthings-room-badge:hover {
    background: rgba(255, 159, 74, 0.25);
    border-color: rgba(255, 159, 74, 0.5);
    transform: scale(1.05);
}

/* ========== HEADER E LAYOUT ========== */
.page-header-smartthings {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-title-smartthings {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-back {
    padding: 10px 20px;
}

.smartthings-filters-container {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.08), rgba(0, 136, 255, 0.05));
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
}

.filters-content-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
}

.filters-section {
    flex: 1;
    min-width: 200px;
}

.filters-title {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: #00d4ff;
    font-weight: 600;
}

.room-filters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.smartthings-action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.smartthings-action-buttons button {
    white-space: nowrap;
}

.device-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 212, 255, 0.15);
}

/* ========== CABEÇALHOS PADRONIZADOS MOBILE ========== */
.page-header-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    min-height: 48px;
}

.page-title-mobile {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
    flex: 1;
    min-width: 0;
}

.page-icon-mobile {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: block;
}

.page-header-mobile .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Responsivo para Mobile */
@media (max-width: 768px) {
    .page-header-mobile {
        gap: 10px;
        margin-bottom: 16px;
    }
    
    .page-title-mobile {
        font-size: 20px;
        gap: 7px;
    }
    
    .page-icon-mobile {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 480px) {
    .page-header-mobile {
        gap: 8px;
        margin-bottom: 14px;
    }
    
    .page-title-mobile {
        font-size: 17px;
        gap: 6px;
    }
    
    .page-icon-mobile {
        width: 34px;
        height: 34px;
    }
    
    .page-header-mobile .btn {
        padding: 7px 12px !important;
        font-size: 12px !important;
    }
}
