/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Cores Hexagon */
:root {
    --hexagon-blue: #0097B8;
    --hexagon-light-blue: #75C2D4;
    --hexagon-green: #B8D978;
    --hexagon-black: #000000;
    --hexagon-dark: #1a1a1a;
    --hexagon-gray: #f5f5f5;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--hexagon-blue) 0%, var(--hexagon-light-blue) 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Header */
.header {
    background: white;
    padding: 25px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-logo {
    height: 160px;
    width: auto;
}

.header h1 {
    color: var(--hexagon-blue);
    font-size: 2em;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-tv {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--hexagon-blue) 0%, var(--hexagon-light-blue) 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 151, 184, 0.3);
}

.btn-tv:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 151, 184, 0.4);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: #f5f5f5;
    border-radius: 25px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--hexagon-green);
}

.status-dot.error {
    background: #f44336;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 450px;
    gap: 25px;
    min-height: calc(100vh - 150px);
}

/* Cards Area */
.cards-area {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.cards-area h2 {
    color: var(--hexagon-blue);
    margin-bottom: 5px;
    font-size: 1.6em;
}

.cards-area .subtitle {
    color: #888;
    margin-bottom: 25px;
    font-size: 0.95em;
}

/* Cards Section */
.cards-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.cards-section:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
}

.cards-section h2 {
    color: var(--hexagon-blue);
    margin-bottom: 5px;
    font-size: 1.4em;
}

.cards-section .subtitle {
    color: #888;
    margin-bottom: 20px;
    font-size: 0.9em;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

/* Grid de 4 colunas para cards de entrega */
.cards-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.cards-grid-4 .card {
    padding: 18px;
    gap: 12px;
}

.cards-grid-4 .card-icon {
    font-size: 2.2em;
    min-width: 45px;
}

.cards-grid-4 .card-value {
    font-size: 2em;
}

.cards-grid-4 .card-label {
    font-size: 0.85em;
}

.cards-grid-4 .card-subtitle {
    font-size: 0.7em;
}

@media (max-width: 1400px) {
    .cards-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .cards-grid-4 .card {
        padding: 20px;
    }

    .cards-grid-4 .card-value {
        font-size: 2.2em;
    }
}

@media (max-width: 600px) {
    .cards-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Card Styles */
.card {
    background: linear-gradient(135deg, var(--hexagon-blue) 0%, var(--hexagon-light-blue) 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

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

.card.active {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    outline: 3px solid rgba(255, 255, 255, 0.5);
}

.card-icon {
    font-size: 3em;
    min-width: 60px;
    text-align: center;
}

.card-content {
    flex: 1;
}

.card-label {
    font-size: 0.95em;
    opacity: 0.9;
    margin-bottom: 5px;
}

.card-value {
    font-size: 2.8em;
    font-weight: 700;
    line-height: 1.1;
}

.card-value.loading {
    font-size: 1.5em;
    opacity: 0.7;
}

.card-subtitle {
    font-size: 0.75em;
    opacity: 0.8;
    margin-top: 2px;
    font-weight: 400;
}

.card-registros {
    font-size: 0.85em;
    opacity: 0.9;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Card Skeleton Loading */
.card-skeleton {
    background: linear-gradient(135deg, #e0e0e0 0%, #f0f0f0 100%);
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.skeleton-icon {
    width: 60px;
    height: 60px;
    background: #ccc;
    border-radius: 10px;
    animation: shimmer 1.5s infinite;
}

.skeleton-content {
    flex: 1;
}

.skeleton-line {
    height: 20px;
    background: #ccc;
    border-radius: 4px;
    margin-bottom: 10px;
    animation: shimmer 1.5s infinite;
}

.skeleton-line.short {
    width: 60%;
    height: 35px;
}

@keyframes shimmer {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

/* Refresh Button */
.btn-refresh {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 25px;
    background: linear-gradient(135deg, var(--hexagon-blue) 0%, var(--hexagon-light-blue) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Details Panel */
.details-panel {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 150px);
}

.details-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--hexagon-blue) 0%, var(--hexagon-light-blue) 100%);
    border-radius: 15px 15px 0 0;
    color: white;
}

.details-header h3 {
    font-size: 1.2em;
    font-weight: 600;
}

.details-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-export {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-export:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    font-size: 1.1em;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.details-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    text-align: center;
    color: #888;
}

.empty-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1em;
    line-height: 1.6;
    max-width: 280px;
}

/* Details List */
.details-summary {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.details-summary span {
    font-weight: 600;
    color: var(--hexagon-blue);
}

.details-list {
    list-style: none;
}

.detail-item {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.detail-item:hover {
    background: #f8f9fa;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-serial {
    font-weight: 700;
    color: #333;
    font-size: 1.05em;
    margin-bottom: 8px;
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85em;
    color: #666;
}

.detail-info span,
.detail-info div {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 0;
}

.detail-info .label {
    color: #999;
    font-size: 0.9em;
}

.detail-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    background: #e3f2fd;
    color: #1976d2;
}

/* Search Box */
.search-box {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 0.95em;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--hexagon-blue);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin-top: 20px;
    font-size: 1.2em;
}

/* Scrollbar Styling */
.details-content::-webkit-scrollbar {
    width: 8px;
}

.details-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.details-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.details-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Error Message */
.error-message {
    padding: 20px;
    margin: 20px;
    background: #fff3f3;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    color: #c62828;
    text-align: center;
}

/* Loading State for Details */
.details-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
}

.details-loading .spinner {
    border-color: rgba(102, 126, 234, 0.2);
    border-top-color: var(--hexagon-blue);
}

.details-loading p {
    margin-top: 15px;
    color: #888;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .details-panel {
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header h1 {
        font-size: 1.6em;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .card-value {
        font-size: 2.2em;
    }
}