* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden; /* evita scroll horizontal */
    max-width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    min-width: 0;
}

header {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 28px;
    color: #667eea;
}

.assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.asset-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.asset-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.asset-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
    gap: 10px;
}

.asset-header h3 {
    color: #333;
    font-size: 18px;
    flex: 1;
}

.asset-code {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.asset-body {
    margin-bottom: 15px;
}

.asset-url {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.asset-url .label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    font-size: 13px;
}

.url-container {
    display: flex;
    gap: 8px;
    align-items: stretch;
    min-width: 0; /* permite shrink */
}

.url-input {
    flex: 1;
    min-width: 0; /* evita overflow dentro do flex */
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    color: #667eea;
    background: #f8f9fa;
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.asset-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
}

.info-item .label {
    font-weight: 600;
    color: #555;
}

.asset-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

/* Botões de ação com ícone SVG */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px 6px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Tooltip nativo melhorado via title — e tooltip CSS */
.btn-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}
.btn-icon:hover::after { opacity: 1; }

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    margin-bottom: 15px;
}

.btn-with-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}
.btn-with-icon svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.empty-state {
    background: white;
    padding: 60px 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.empty-state p {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 20px;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: #000;
}

#modal-title {
    margin-bottom: 20px;
    color: #667eea;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

#maintenance-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

#maintenance-section h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.maintenance-item {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.maintenance-item .form-row {
    grid-template-columns: 1fr 2fr auto;
    align-items: end;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.form-actions .btn {
    flex: 1;
}

.qr-modal-content {
    text-align: center;
}

#qr-code {
    margin: 20px auto;
    display: inline-block;
}

#qr-url {
    word-break: break-all;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 12px;
    color: #666;
}

.view-details {
    line-height: 1.8;
}

.view-details p {
    margin-bottom: 10px;
}

.view-details strong {
    color: #667eea;
}

.maintenance-list {
    list-style: none;
    margin-top: 10px;
}

.maintenance-list li {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
}

.maintenance-list li strong {
    color: #667eea;
}

.maintenance-list li p {
    margin-top: 5px;
    color: #666;
    font-size: 14px;
}

@media (max-width: 768px) {
    .assets-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .maintenance-item .form-row {
        grid-template-columns: 1fr;
    }

    /* asset-actions permanece 4 colunas — ícones já são compactos */

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-content {
        padding: 20px;
        margin: 10px;
        max-width: calc(100vw - 20px);
    }

    .modal {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 22px;
    }

    .asset-card {
        padding: 15px;
    }

    .asset-header {
        flex-wrap: wrap;
    }

    /* Garante que o grid de assets não vaze */
    .assets-grid {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .asset-card {
        min-width: 0;
        overflow: hidden;
    }

    /* Info items não quebram para fora */
    .info-item {
        flex-wrap: wrap;
        gap: 4px;
    }
}
