:root {
    --primary-color: #007bff;
    --bg-color: #f0f2f5;
    --text-color: #333;
    --input-bg: #fff;
    --input-border: #ddd;
    --header-bg: #fff;
    --header-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: transparent !important;
    color: var(--text-color);
    overflow: hidden;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    background: transparent !important;
}

.view.fading {
    opacity: 0;
    pointer-events: none;
}

.hidden {
    display: none !important;
}

/* Dynamic Background */
#dynamic-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Colocado atrás de tudo */
    overflow: hidden;
    background-color: #f0f2f5; /* Cor de fundo mais clara e suave */
}

.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out; /* Transição um pouco mais rápida e suave */
    background-color: #f0f2f5; /* Cor de backup mais clara */
}

.bg-layer.active {
    opacity: 1;
}

/* Home View Styling */
.home-view {
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    background: transparent; /* Permite ver o fundo dinâmico */
}

.top-actions {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.action-icon {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon:hover {
    background-color: #e9ecef;
    color: var(--primary-color);
    transform: scale(1.1);
}

.home-container {
    text-align: center;
    max-width: 500px;
    width: 100%;
    background: rgba(255, 255, 255, 0.9); /* Fundo semi-transparente para o container */
    backdrop-filter: blur(10px); /* Efeito de desfoque moderno */
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.app-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 20px;
    cursor: pointer;
    transition: transform 0.2s;
}

.app-logo:hover {
    transform: scale(1.05);
}

p {
    margin-bottom: 30px;
    color: #666;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.content-editable-main,
.content-editable-url,
.content-editable {
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    background: white;
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    white-space: nowrap;
    text-align: left;
}

.content-editable-main:focus,
.content-editable-url:focus,
.content-editable:focus {
    border-color: var(--primary-color);
}

.content-editable-main:empty::before,
.content-editable-url:empty::before,
.content-editable:empty::before {
    content: attr(placeholder);
    color: #999;
}

.masked-input {
    -webkit-text-security: disc;
    text-security: disc;
}

#access-button {
    padding: 15px;
    font-size: 1.1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

#access-button:hover {
    background-color: #0056b3;
}

.error {
    color: #dc3545;
    margin-top: 15px;
    font-size: 0.9rem;
}

/* Error Message Animation */
.error-fade-in-out {
    animation: fadeAuto 4s forwards;
}

@keyframes fadeAuto {
    0% { opacity: 0; transform: translateY(-10px); }
    15% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* Browser View Styling */
.browser-header {
    height: 60px;
    background: var(--header-bg);
    display: flex;
    align-items: center;
    padding: 0 15px;
    box-shadow: var(--header-shadow);
    z-index: 10;
}

#home-button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#home-button:hover {
    background-color: #f0f0f0;
}

.url-display {
    flex: 1;
    margin-left: 15px;
    font-size: 0.9rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browser-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 15px;
}

.browser-title {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.iframe-container {
    flex: 1;
    position: relative;
    background: transparent;
}

#browser-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Admin View Styling */
.admin-view {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.admin-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 450px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.admin-header {
    padding: 25px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    align-items: center;
    background: rgba(248, 249, 250, 0.5);
}

.admin-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

.close-button {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-button:hover {
    background: #ff4d4d;
    color: white;
    transform: rotate(90deg);
}

.admin-content {
    padding: 30px;
}

/* Auth Card Styling */
.auth-card {
    text-align: center;
}

.auth-icon-header {
    margin-bottom: 25px;
    background: rgba(0, 123, 255, 0.1);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

.auth-card h3 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    color: var(--text-color);
    font-weight: 700;
}

.auth-card p {
    margin-bottom: 30px;
    font-size: 1rem;
    color: #666;
}

/* Input Styles in Admin */
.admin-view .input-group {
    margin-bottom: 20px;
}

.admin-view .content-editable,
.admin-view .content-editable-url {
    border: 2px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    padding: 18px;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.admin-view .content-editable:focus,
.admin-view .content-editable-url:focus {
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.1);
}

/* Admin Buttons */
#auth-button, #add-url-button {
    padding: 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    transition: all 0.3s;
}

#auth-button:hover, #add-url-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

#auth-button:active, #add-url-button:active {
    transform: translateY(0);
}

.code-display {
    background: #f8f9fa;
    border: 2px solid #eee;
    border-radius: 8px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}

.masked-display {
    font-size: 1.5rem;
    letter-spacing: 8px;
    color: var(--primary-color);
    font-family: monospace;
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 250px;
    margin: 0 auto 20px;
}

.num-btn {
    aspect-ratio: 1;
    border: 1px solid #eee;
    background: #fff;
    border-radius: 50%;
    font-size: 1.25rem;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.num-btn:hover {
    background: #f0f0f0;
    border-color: #ddd;
}

.num-btn:active {
    background: #e0e0e0;
    transform: scale(0.95);
}

.num-btn.clear {
    color: #dc3545;
}

.num-btn.del {
    color: #666;
}

.auth-submit-btn {
    width: 100%;
    max-width: 250px;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-submit-btn:hover {
    background: #0056b3;
}

.content-editable-main,
.content-editable-url {
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    background: white;
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    white-space: nowrap;
    text-align: left;
}

.content-editable-main:focus,
.content-editable-url:focus {
    border-color: var(--primary-color);
}

.content-editable-main:empty::before,
.content-editable-url:empty::before {
    content: attr(placeholder);
    color: #999;
}

.mini-loader {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 15px auto;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* URL List Styling */
.allowed-list-container {
    margin-top: 30px;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.03);
    padding: 5px;
}

#allowed-urls-list li {
    padding: 15px 20px;
    background: white;
    margin-bottom: 8px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

#allowed-urls-list li:last-child {
    margin-bottom: 0;
}

.remove-url {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0; /* Esconde o texto "Remover" */
    background: #fff0f0;
    cursor: pointer;
    transition: all 0.2s;
}

.remove-url::after {
    content: '×';
    font-size: 1.5rem;
    color: #ff4d4d;
}

.remove-url:hover {
    background: #ff4d4d;
}

.remove-url:hover::after {
    color: white;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 10px;
}

.pagination-btn {
    background: white;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f9fa;
}

.page-info {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.admin-note {
    margin-top: 25px;
    text-align: center;
    font-size: 0.9rem;
}

/* Loader Styling */
.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 5;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .home-container, .admin-container {
        max-width: 90%;
        padding: 30px 20px;
    }

    .app-logo {
        max-width: 150px;
    }

    .content-editable-main,
    .content-editable-url,
    .content-editable {
        font-size: 1rem;
        padding: 12px 15px;
        min-height: 50px;
    }

    #access-button, #auth-button, #add-url-button {
        padding: 12px;
        font-size: 1rem;
    }

    .admin-header {
        padding: 15px 20px;
    }

    .admin-header h2 {
        font-size: 1.2rem;
    }

    .admin-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .home-container, .admin-container {
        max-width: 95%;
        padding: 25px 15px;
    }

    .top-actions {
        top: 10px;
    }

    .action-icon {
        padding: 8px;
    }

    .app-logo {
        max-width: 120px;
        margin-bottom: 15px;
    }

    p {
        margin-bottom: 20px;
        font-size: 0.9rem;
    }

    .browser-header {
        padding: 0 10px;
        height: 50px;
    }

    #home-button {
        padding: 5px;
    }

    .url-display {
        font-size: 0.8rem;
        margin-left: 10px;
    }

    .pagination-controls {
        gap: 10px;
        flex-wrap: wrap;
    }

    .pagination-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .page-info {
        font-size: 0.8rem;
    }
}
