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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

/* Page Management */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 10px;
    font-size: 2em;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

.form-group small {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 12px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

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

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

.btn-small, .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Error Messages */
.error-message {
    color: #e74c3c;
    background: #fadbd8;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    display: none;
    font-size: 14px;
}

.error-message.show {
    display: block;
}

/* Header */
.header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #667eea;
    font-size: 1.8em;
}

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

.user-name {
    color: #666;
    font-weight: 500;
}

/* Main Content */
.main-content {
    padding-bottom: 40px;
}

/* Section */
.section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Websites Grid */
.websites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.website-card {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
    cursor: pointer;
}

.website-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.website-card h3 {
    color: #667eea;
    margin-bottom: 8px;
    font-size: 1.2em;
}

.website-card .domain {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.website-card .website-id {
    color: #999;
    font-size: 0.85em;
    font-family: monospace;
    margin-bottom: 10px;
}

.website-card .stats {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.website-card .stat {
    text-align: center;
}

.website-card .stat-label {
    font-size: 0.75em;
    color: #999;
    text-transform: uppercase;
}

.website-card .stat-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}

.website-card .actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.stat-card h3 {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 15px;
    text-transform: uppercase;
    font-weight: 600;
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #667eea;
}

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

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

.stat-item-label {
    color: #666;
}

.stat-item-value {
    font-weight: bold;
    color: #667eea;
}

/* Table */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    background: #f9f9f9;
    font-weight: 600;
    color: #666;
    font-size: 0.9em;
    text-transform: uppercase;
}

.table tbody tr:hover {
    background: #f9f9f9;
}

.table td {
    font-size: 0.9em;
}

/* URL cell - truncate with ellipsis, show full on hover */
.url-cell {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85em;
    color: #667eea;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.url-cell:hover {
    color: #4c5fd5;
    text-decoration: underline;
}

/* Tooltip personalizado para URLs largas */
.url-cell:hover::after {
    content: "Click para copiar";
    position: absolute;
    bottom: 100%;
    left: 0;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    margin-bottom: 5px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal form {
    padding: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.form-actions .btn {
    width: auto;
}

/* Code Block */
.code-block {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    margin: 15px 0;
}

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

.info-group label {
    display: block;
    font-weight: 600;
    color: #666;
    margin-bottom: 5px;
}

.info-group p {
    color: #333;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

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

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

    .table {
        font-size: 0.85em;
    }

    .table th,
    .table td {
        padding: 8px;
    }
}

/* ============================================
   UPDATE BANNER STYLES
   ============================================ */

.update-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.update-banner.hidden {
    display: none;
}

.update-banner-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.update-banner-icon {
    font-size: 2.5em;
    flex-shrink: 0;
}

.update-banner-text {
    flex: 1;
    min-width: 250px;
}

.update-banner-text strong {
    display: block;
    font-size: 1.2em;
    margin-bottom: 5px;
}

.update-banner-text p {
    margin: 0;
    opacity: 0.95;
    font-size: 0.95em;
}

.update-banner-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.update-banner-actions .btn {
    white-space: nowrap;
}

/* ============================================
   UPDATE INSTRUCTIONS MODAL STYLES
   ============================================ */

.modal-large {
    max-width: 900px;
}

.update-instructions {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
}

.update-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e0e0e0;
}

.update-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.update-section h3 {
    color: #667eea;
    font-size: 1.3em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.update-features {
    list-style: none;
    padding: 0;
}

.update-features li {
    padding: 12px 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    transition: transform 0.2s;
}

.update-features li:hover {
    transform: translateX(5px);
}

/* Update Steps */
.update-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.update-step {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h4 {
    margin-bottom: 8px;
    color: #333;
    font-size: 1.1em;
}

.step-content p {
    color: #666;
    margin: 5px 0;
}

.code-highlight {
    background: #d4edda !important;
    border: 2px solid #27ae60;
}

/* Installation Methods */
.installation-methods details {
    margin-bottom: 12px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.installation-methods summary {
    cursor: pointer;
    padding: 5px;
    color: #667eea;
    font-size: 1.05em;
    user-select: none;
}

.installation-methods summary:hover {
    color: #764ba2;
}

.installation-methods details[open] summary {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.installation-methods p {
    margin: 10px 0 0 0;
    color: #666;
    line-height: 1.6;
}

/* FAQ */
.faq details {
    margin-bottom: 12px;
    padding: 15px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s;
}

.faq details:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.faq summary {
    cursor: pointer;
    padding: 5px;
    color: #333;
    font-size: 1.05em;
    user-select: none;
}

.faq details[open] summary {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    color: #667eea;
}

.faq p {
    margin: 10px 0 0 0;
    color: #666;
    line-height: 1.6;
}

/* Responsive Updates */
@media (max-width: 768px) {
    .update-banner-content {
        flex-direction: column;
        gap: 15px;
    }

    .update-banner-icon {
        font-size: 2em;
    }

    .update-banner-actions {
        width: 100%;
    }

    .update-banner-actions .btn {
        flex: 1;
    }

    .modal-large {
        max-width: 95%;
    }

    .update-step {
        flex-direction: column;
    }

    .step-number {
        align-self: flex-start;
    }
}

/* Real-time Section Styles */
.realtime-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.realtime-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.realtime-status {
    font-size: 14px;
    color: #666;
    padding: 5px 10px;
    background: #f0f0f0;
    border-radius: 5px;
}

.realtime-status.updating {
    background: #fff3cd;
    color: #856404;
}

.realtime-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.realtime-card h3 {
    color: white;
}

.stat-value-large {
    font-size: 3em !important;
    font-weight: bold;
    margin: 15px 0;
}

.stat-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

.realtime-pages {
    max-height: 200px;
    overflow-y: auto;
}

.realtime-page-item {
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

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

.realtime-page-title {
    font-weight: 500;
    color: #333;
    display: block;
    margin-bottom: 3px;
}

.realtime-page-visitors {
    color: #667eea;
    font-weight: bold;
    font-size: 12px;
}

.realtime-recent {
    max-height: 300px;
    overflow-y: auto;
}

.realtime-recent-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

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

.realtime-recent-info {
    flex: 1;
}

.realtime-recent-page {
    font-weight: 500;
    color: #333;
    margin-bottom: 3px;
}

.realtime-recent-source {
    font-size: 12px;
    color: #666;
}

.realtime-recent-time {
    font-size: 12px;
    color: #999;
    text-align: right;
}

/* Active Sessions Styles */
.realtime-sessions {
    max-height: 500px;
    overflow-y: auto;
}

.session-item {
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.session-item:last-child {
    margin-bottom: 0;
}

.session-info {
    flex: 1;
}

.session-page {
    font-weight: 600;
    color: #333;
    font-size: 15px;
    margin-bottom: 8px;
}

.session-details {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.session-entry {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}

.session-times {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
}

.session-time-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: white;
    border-radius: 4px;
    font-size: 12px;
}

.session-time-label {
    color: #666;
    font-weight: 500;
}

.session-time-value {
    color: #667eea;
    font-weight: 600;
}

@media (max-width: 768px) {
    .realtime-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .realtime-select,
    .realtime-status {
        width: 100%;
    }

    .stat-value-large {
        font-size: 2em !important;
    }

    .session-item {
        flex-direction: column;
        padding: 18px;
        gap: 15px;
    }

    .session-page {
        font-size: 14px;
        line-height: 1.4;
        margin-bottom: 10px;
    }

    .session-details {
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 8px;
    }

    .session-entry {
        font-size: 12px;
        line-height: 1.4;
        margin-top: 8px;
    }

    .session-times {
        min-width: auto;
        width: 100%;
        gap: 10px;
    }

    .session-time-item {
        padding: 8px 12px;
        font-size: 13px;
    }

    .session-time-label,
    .session-time-value {
        font-size: 13px;
    }
}

/* Button for viewing session trail */
.btn-view-trail {
    background: #27ae60;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s ease;
}

.btn-view-trail:hover {
    background: #229954;
}

.btn-view-trail:active {
    transform: scale(0.98);
}

/* Session Trail - Expandible Rows */
.trail-page-row.expandable:hover {
    background: #f8f9fa;
    transition: background 0.2s ease;
}

.expand-icon {
    display: inline-block;
    width: 20px;
    font-size: 12px;
    color: #666;
    transition: transform 0.2s ease;
}

.trail-details-row {
    background: #f9fafb;
    border-top: none !important;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.trail-details-row td {
    padding: 20px !important;
    border-top: none !important;
}

.trail-scroll {
    margin-bottom: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    border-left: 4px solid #4caf50;
    border-radius: 6px;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.trail-scroll .max-depth {
    color: #2e7d32;
    font-weight: 600;
    margin-left: 8px;
    background: #c8e6c9;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
}

.trail-clicks {
    padding: 15px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f1f8fc 100%);
    border-left: 4px solid #2196f3;
    border-radius: 6px;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.click-list {
    margin: 12px 0 0 0;
    padding: 0;
}

.click-list li {
    margin: 8px 0;
    padding: 10px 15px;
    background: white;
    border-radius: 4px;
    list-style: none;
    position: relative;
    padding-left: 35px;
    font-size: 13px;
    color: #333;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
}

.click-list li::before {
    content: '🖱️';
    position: absolute;
    left: 10px;
    font-size: 16px;
}

.click-list li:hover {
    background: #f5f9ff;
    border-color: #2196f3;
    transform: translateX(3px);
}

.click-element {
    color: #1976d2;
    font-weight: 500;
}

.click-time {
    color: #666;
    font-size: 12px;
}

.scroll-at-click {
    color: #4caf50;
    font-size: 11px;
    background: #e8f5e9;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
}
