/* ============================================
   TEMA - MIDNIGHT MINIMAL (DARK)
   ============================================ */

/* Estrutura Base dos Templates */
:root {
    --theme-bg: #ffffff;
    --theme-text: #1F2937;
    --theme-primary: #1A202C;
    --theme-primary-contrast: #ffffff;
    --theme-button-bg: var(--theme-primary);
    --theme-button-text: var(--theme-primary-contrast);
    --theme-card-radius: 14px;
    --theme-card-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
    --theme-card-border: 2px solid #e2e8f0;
}

.templates-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.template-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border: var(--theme-card-border);
    border-radius: var(--theme-card-radius);
    padding: 16px;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
    text-align: left;
    font-family: inherit;
    width: auto;
    box-shadow: var(--theme-card-shadow);
}

.template-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12);
}

.template-card.active {
    border-color: var(--theme-primary);
    background: color-mix(in srgb, var(--theme-primary) 15%, transparent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.template-preview {
    flex-shrink: 0;
    width: 50px;
    height: 70px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    position: relative;
    overflow: hidden;
    font-size: 18px;
    color: white;
}

.template-preview .preview-avatar,
.template-preview .preview-bar {
    opacity: 0.8;
}

.template-preview .preview-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.template-preview .preview-bar {
    width: 50%;
    height: 4px;
    border-radius: 2px;
    opacity: 0.6;
}

.template-content {
    flex: 1;
    min-width: 0;
}

.template-title {
    font-size: 12px;
    font-weight: 600;
    color: #1F2937;
    margin: 0 0 2px 0;
}

.template-description {
    font-size: 10px;
    color: #6B7280;
    margin: 0;
    line-height: 1.2;
}

.template-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.template-badge.dark { background: #1A202C; color: #FFFFFF; }
.template-badge.livre { background: transparent; display: none; }

@media (max-width: 768px) {
    .templates-container { grid-template-columns: 1fr; }
    .template-card { flex-direction: column; gap: 12px; padding: 12px; width: 100%; }
    .template-preview { width: 100%; height: 80px; }
    .template-content { width: 100%; }
    .template-badge { top: 12px; right: 12px; }
}

/* Estilos Específicos do Midnight Minimal */
.dark-preview {
    background: #000000;
}

.dark-preview .preview-avatar,
.dark-preview .preview-bar {
    background: rgba(255, 255, 255, 0.85);
}

.template-card.active[onclick*="'dark'"] {
    border-color: #1A202C;
    background: rgba(26, 32, 44, 0.2);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.phone-screen .store-content.theme-dark .store-location i,
body.theme-dark .perfil-endereco i {
    color: #ffffff !important;
}

.phone-screen .store-content.theme-dark .perfil-view-counter,
.phone-screen .store-content.theme-dark .perfil-view-counter i,
.phone-screen .store-content.theme-dark .perfil-view-counter span {
    color: #ffffff !important;
}

.phone-screen .store-content.theme-dark .store-name,
.phone-screen .store-content.theme-dark .store-bio,
.phone-screen .store-content.theme-dark .store-location,
.phone-screen .store-content.theme-dark .section-title-small,
body.theme-dark .perfil-nome,
body.theme-dark .perfil-bio,
body.theme-dark .perfil-endereco,
body.theme-dark .section-title {
    color: #ffffff !important;
}

body.theme-dark .section-title,
body.theme-dark .section-header-inline .section-title,
body.theme-dark .section-header-flex .section-title {
    color: #ffffff !important;
    opacity: 1 !important;
}

body.theme-dark {
    --theme-button-list-bg: #ffffff;
    --theme-button-list-text: #000000;
}

.phone-screen .store-content.theme-dark #links-preview-section,
body.theme-dark #links-preview-section {
    margin-top: 0 !important;
    margin-bottom: 18px !important;
}

.phone-screen .store-content.theme-dark #links-preview-section .phone-link-item,
body.theme-dark .phone-link-item {
    background-color: var(--theme-button-list-bg, #ffffff) !important;
    color: var(--theme-button-list-text, #000000) !important;
    padding: 5px 11px !important;
    gap: 8px !important;
    margin-bottom: 3px !important;
    border: none !important;
    border-radius: 14px !important;
    box-shadow: none !important;
    min-height: 40px !important;
}

.phone-screen .store-content.theme-dark #links-preview-section .phone-link-item .phone-link-icon,
body.theme-dark .phone-link-icon {
    background-color: transparent !important;
    color: var(--theme-button-list-text, #000000) !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.phone-screen .store-content.theme-dark #links-preview-section .phone-link-item .phone-link-icon i,
body.theme-dark .phone-link-icon i {
    color: var(--theme-button-list-text, #000000) !important;
    font-size: 15px !important;
}

.phone-screen .store-content.theme-dark #links-preview-section .phone-link-main,
body.theme-dark .phone-link-main {
    width: 100% !important;
    justify-content: var(--theme-link-justify, flex-start) !important;
    gap: 12px !important;
}

.phone-screen .store-content.theme-dark #links-preview-section .phone-link-item .phone-link-title,
body.theme-dark .phone-link-title {
    color: var(--theme-button-list-text, #000000) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    margin-bottom: 0 !important;
}

body.theme-dark .link-button,
body.theme-dark .link-button .link-text,
body.theme-dark .link-button .phone-link-text,
body.theme-dark .link-button .phone-link-title,
body.theme-dark .link-button .link-arrow,
body.theme-dark .link-button .phone-link-arrow,
body.theme-dark .link-button .phone-link-arrow i {
    color: #000000 !important;
}

.phone-screen .store-content.theme-dark .secondary-gallery-view-btn,
body.theme-dark .secondary-gallery-view-btn {
    color: rgba(255, 255, 255, 0.92);
}

.phone-screen .store-content.theme-dark .secondary-gallery-view-btn:hover,
body.theme-dark .secondary-gallery-view-btn:hover {
    color: #ffffff;
}

.phone-screen .store-content.theme-dark .secondary-gallery-view-btn.active,
body.theme-dark .secondary-gallery-view-btn.active {
    background: #ffffff;
    color: #0f172a;
}

.phone-screen .store-content.theme-dark #links-preview-section .phone-link-item .phone-link-value,
body.theme-dark .phone-link-value {
    font-size: 8px;
}

.phone-screen .store-content.theme-dark #links-preview-section .phone-link-item .phone-link-text div:first-child {
    color: var(--theme-button-list-text, #000000) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    margin-bottom: 0 !important;
    line-height: 1.5 !important;
}

.phone-screen .store-content.theme-dark #links-preview-section .phone-link-item .phone-link-text div:last-child {
    font-size: 8px;
    line-height: 1.05;
}

.phone-screen .store-content.theme-dark #links-preview-section .phone-link-item .phone-link-arrow i {
    font-size: 13px;
}

.phone-screen .store-content.theme-dark #links-preview-section .phone-link-item .phone-link-title {
    color: var(--theme-button-list-text, #000000) !important;
    font-size: 14px !important;
}

.phone-screen .store-content.theme-dark #links-preview-section .phone-link-item .phone-link-text div:first-child {
    color: var(--theme-button-list-text, #000000) !important;
    font-size: 12px;
    line-height: 1.2;
}

.phone-screen .store-content.theme-dark .segment-tag,
body.theme-dark .segment-tag {
    background: #ffffff !important;
    color: #111827 !important;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
}

body.theme-dark .link-type-btn:hover,
body.theme-dark .link-type-btn:focus-visible,
.phone-screen .store-content.theme-dark .link-type-btn:hover,
.phone-screen .store-content.theme-dark .link-type-btn:focus-visible {
    border-color: #1A202C !important;
    color: #1A202C !important;
    outline: none;
}

body.theme-dark .checkbox-field input[type="checkbox"],
body.theme-dark .checkbox-label input[type="checkbox"],
body.theme-dark .sn-checkbox input,
.phone-screen .store-content.theme-dark .checkbox-field input[type="checkbox"],
.phone-screen .store-content.theme-dark .checkbox-label input[type="checkbox"],
.phone-screen .store-content.theme-dark .sn-checkbox input {
    accent-color: #1A202C;
}

body.theme-dark .sn-checkbox,
.phone-screen .store-content.theme-dark .sn-checkbox {
    color: #ffffff;
}

body.theme-dark .form-control:focus,
.phone-screen .store-content.theme-dark .form-control:focus {
    border-color: #1A202C;
    box-shadow: 0 0 0 3px rgba(26, 32, 44, 0.12);
}

body[data-panel-template="dark"] .upload-gallery-area,
body[data-panel-template="dark"] .upload-gallery-area h4,
body[data-panel-template="dark"] .upload-gallery-area p,
body[data-panel-template="dark"] .upload-gallery-area small,
body[data-panel-template="dark"] .upload-gallery-area .limit-info,
body[data-panel-template="dark"] .upload-gallery-area .limit-info span {
    color: #000000 !important;
}

/* Loja publica: manter laterais brancas e bloco interno escuro coeso */
body.public-store-page.theme-dark #perfil-container > .store-header,
body.public-store-page.theme-dark #perfil-container > .perfil-content {
    background: var(--theme-bg, #000000) !important;
    background-color: var(--theme-bg, #000000) !important;
}

body.public-store-page.theme-dark #section-links,
body.public-store-page.theme-dark #section-gallery,
body.public-store-page.theme-dark #section-gallery-secondary,
body.public-store-page.theme-dark #section-videos,
body.public-store-page.theme-dark .perfil-section,
body.public-store-page.theme-dark .secondary-gallery-feed,
body.public-store-page.theme-dark .secondary-gallery-grid,
body.public-store-page.theme-dark .gallery-story-summary {
    background: transparent !important;
    background-color: transparent !important;
}

body.public-store-page.theme-dark .store-content .store-header {
    margin-bottom: 0 !important;
}

body.public-store-page.theme-dark .perfil-header.store-header .perfil-avatar,
body.public-store-page.theme-dark .perfil-header.store-header .store-avatar {
    background: #1a202c !important;
}

body.public-store-page.theme-dark #links-preview-section .phone-link-item {
    padding: 5px 11px !important;
    gap: 8px !important;
    margin-bottom: 3px !important;
    border-radius: 11px !important;
}

body.public-store-page.theme-dark #links-preview-section .phone-link-icon {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    border-radius: 9px !important;
}

body.public-store-page.theme-dark #links-preview-section .phone-link-icon i {
    font-size: 15px !important;
}

body.public-store-page.theme-dark #links-preview-section .phone-link-title,
body.public-store-page.theme-dark #links-preview-section .phone-link-text div:first-child {
    color: #000000 !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
}

body.public-store-page.theme-dark #links-preview-section .phone-link-value,
body.public-store-page.theme-dark #links-preview-section .phone-link-text div:last-child {
    color: #000000 !important;
    font-size: 8px !important;
    line-height: 1.05 !important;
}

body.public-store-page.theme-dark #links-preview-section .phone-link-arrow i {
    font-size: 13px !important;
}

body.public-store-page.theme-dark .store-share-button {
    background: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

body.public-store-page.theme-dark .store-share-icon path,
body.public-store-page.theme-dark .store-share-icon circle {
    stroke: #ffffff !important;
    fill: #ffffff !important;
}

body.public-store-page.theme-dark .gallery-story-card {
    background: #111827 !important;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

body.public-store-page.theme-dark .gallery-story-avatar {
    background: #1f2937 !important;
    color: #e5e7eb !important;
}

body.public-store-page.theme-dark .gallery-story-meta strong,
body.public-store-page.theme-dark .gallery-story-meta span,
body.public-store-page.theme-dark .gallery-story-text p {
    color: #f3f4f6 !important;
}

body.public-store-page.theme-dark .gallery-story-media,
body.public-store-page.theme-dark .gallery-story-media img,
body.public-store-page.theme-dark .gallery-story-media video,
body.public-store-page.theme-dark .gallery-story-media iframe {
    background: #0f172a !important;
}

body.public-store-page.theme-dark .secondary-gallery-view-switch {
    background: rgba(255, 255, 255, 0.08) !important;
}

body.public-store-page.theme-dark .secondary-gallery-view-btn {
    color: rgba(255, 255, 255, 0.8) !important;
}

body.public-store-page.theme-dark .secondary-gallery-view-btn.active {
    background: #ffffff !important;
    color: #0f172a !important;
}

body.public-store-page.theme-dark .secondary-gallery-thumb {
    background: #111827 !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

body.public-store-page.theme-dark .secondary-gallery-thumb img,
body.public-store-page.theme-dark .secondary-gallery-thumb video {
    background: #0f172a !important;
}

body.public-store-page.theme-dark .contact-card-download__button {
    background: #111827 !important;
    color: #f9fafb !important;
    border-color: rgba(148, 163, 184, 0.32) !important;
}

body.public-store-page.theme-dark .contact-card-download__button i {
    color: #ffffff !important;
}

body.public-store-page.theme-dark .segment-tag {
    background: #ffffff !important;
    color: #111827 !important;
}
