/* Modern Dark Theme for mcpages.net - Discord Inspired */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Discord-inspired color palette */
    --bg-primary: #36393f;
    --bg-secondary: #2f3136;
    --bg-tertiary: #202225;
    --bg-quaternary: #18191c;
    --bg-card: #40444b;
    --bg-hover: #4f545c;
    
    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: #b9bbbe;
    --text-muted: #72767d;
    --text-link: #00b0f4;
    
    /* Accent colors */
    --accent-primary: #5865f2;
    --accent-hover: #4752c4;
    --accent-success: #3ba55d;
    --accent-warning: #faa61a;
    --accent-danger: #ed4245;
    
    /* Border and shadow */
    --border-color: #4f545c;
    --shadow-light: 0 2px 10px 0 rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 4px 15px 0 rgba(0, 0, 0, 0.3);
    --shadow-heavy: 0 8px 30px 0 rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    font-weight: 400;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Footer */
.site-header {
    background: var(--bg-quaternary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    transition: color 0.2s ease;
}

.logo a:hover {
    color: var(--accent-primary);
}

.main-nav {
    display: flex;
    gap: 24px;
}

.main-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.site-footer {
    background: var(--bg-quaternary);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.site-main {
    flex-grow: 1;
    padding: 32px 0;
}

.site-main .container {
    background: var(--bg-primary);
    padding: 32px;
    border-radius: 12px;
    box-shadow: var(--shadow-medium);
    margin: 0 auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin: 0 0 16px 0;
    line-height: 1.3;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

h2 {
    font-size: 24px;
    margin-bottom: 16px;
}

h3 {
    font-size: 20px;
    margin-bottom: 12px;
}

p {
    color: var(--text-secondary);
    margin: 0 0 16px 0;
}

/* Buttons */
.btn, .btn-select, .btn-save, .add-item-btn, #add-new-section-btn, #editor-save-button {
    background: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-light);
}

.btn:hover, .btn-select:hover, .btn-save:hover, .add-item-btn:hover, #add-new-section-btn:hover, #editor-save-button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.btn:active, .btn-select:active, .btn-save:active {
    transform: translateY(0);
}

/* Success button variant */
.editor-form .btn-save, #editor-save-button {
    background: var(--accent-success);
}

.editor-form .btn-save:hover, #editor-save-button:hover {
    background: #2d7d47;
}

/* Template Gallery */
.template-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.template-card:hover {
    background: var(--bg-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--accent-primary);
}

.template-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.template-card h3 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

/* Forms */
.editor-form fieldset {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    background: var(--bg-secondary);
}

.editor-form legend {
    font-weight: 600;
    font-size: 16px;
    padding: 0 12px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.editor-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="color"],
textarea,
select {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
}

input[type="color"] {
    height: 44px;
    cursor: pointer;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* Editor Layout */
.editor-v2-layout {
    display: flex;
    gap: 24px;
    margin-top: 24px;
}

.editor-v2-controls {
    flex: 0 0 450px;
    max-width: 450px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    padding-right: 16px;
}

.editor-v2-preview-area {
    flex-grow: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.editor-v2-preview-area h3 {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 16px 20px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.editor-v2-preview-area iframe {
    width: 100%;
    height: calc(100vh - 250px);
    border: none;
}

/* Editor Panels */
.editor-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.editor-panel-header {
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.editor-panel-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-panel-header h4 i {
    color: var(--accent-primary);
}

.editor-panel-actions {
    display: flex;
    gap: 4px;
}

.editor-panel-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.editor-panel-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.editor-panel-actions .remove-section-btn {
    color: var(--accent-danger);
}

.editor-panel-actions .remove-section-btn:hover {
    background: var(--accent-danger);
    color: var(--text-primary);
}

.editor-panel-content {
    padding: 16px;
}

.editor-panel-content.collapsed {
    display: none;
}

/* Dashboard */
#my-pages-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#my-pages-list li {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

#my-pages-list li:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

#my-pages-list .page-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

#my-pages-list .page-actions {
    display: flex;
    gap: 8px;
}

#my-pages-list .page-actions a,
#my-pages-list .page-actions button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

#my-pages-list .edit-btn {
    background: var(--accent-warning);
    color: var(--text-primary);
}

#my-pages-list .view-btn {
    background: var(--accent-primary);
    color: var(--text-primary);
}

#my-pages-list .delete-btn {
    background: var(--accent-danger);
    color: var(--text-primary);
}

#my-pages-list .page-actions a:hover,
#my-pages-list .page-actions button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

/* Form Item Groups */
.form-item-group {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}

.form-item-group .remove-item-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent-danger);
    color: var(--text-primary);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.form-item-group .remove-item-btn:hover {
    background: #c23a3a;
    transform: scale(1.1);
}

/* Alerts */
.alert {
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 14px;
    border-left: 4px solid;
}

.alert-success {
    background: rgba(59, 165, 93, 0.1);
    color: #4ade80;
    border-left-color: var(--accent-success);
}

.alert-danger {
    background: rgba(237, 66, 69, 0.1);
    color: #f87171;
    border-left-color: var(--accent-danger);
}

.alert-info {
    background: rgba(0, 176, 244, 0.1);
    color: #60a5fa;
    border-left-color: var(--text-link);
}

.alert-warning {
    background: rgba(250, 166, 26, 0.1);
    color: #fbbf24;
    border-left-color: var(--accent-warning);
}

/* Add Section Controls */
.add-section-controls {
    text-align: center;
    margin: 24px 0;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.add-section-controls select {
    margin-right: 12px;
    padding: 10px 16px;
    min-width: 200px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Page Template Styles */
.page-template-body {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.page-hero {
    padding: 80px 20px;
    text-align: center;
    background-size: cover;
    background-position: center;
    color: var(--text-primary);
    position: relative;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.page-hero > * {
    position: relative;
    z-index: 2;
}

.page-hero h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    margin-bottom: 16px;
    font-weight: 700;
}

.page-hero p {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    margin-bottom: 32px;
    opacity: 0.9;
}

.page-hero .btn-cta {
    background: var(--accent-primary);
    color: var(--text-primary);
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: inline-block;
}

.page-hero .btn-cta:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.page-section {
    padding: 80px 0;
    text-align: center;
}

.page-section.alternate-bg {
    background: var(--bg-primary);
}

.page-section h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 48px;
    color: var(--text-primary);
}

/* Feature Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-item-display {
    background: var(--bg-card);
    padding: 32px 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.feature-item-display:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--accent-primary);
}

.feature-item-display i {
    font-size: 3rem;
    color: var(--accent-primary);
    margin-bottom: 20px;
    display: block;
}

.feature-item-display h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.feature-item-display p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Gallery */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-container img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.gallery-container img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-medium);
}

/* Info Cards */
.info-cards-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.info-card-display {
    background: var(--bg-card);
    padding: 32px 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.info-card-display:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--accent-primary);
}

.info-card-display i {
    font-size: 3rem;
    color: var(--accent-primary);
    margin-bottom: 20px;
    display: block;
}

.info-card-display h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.info-card-display p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer */
.page-footer-rendered {
    background: var(--bg-quaternary);
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 992px) {
    .editor-v2-layout {
        flex-direction: column;
    }
    
    .editor-v2-controls {
        flex: none;
        max-width: none;
        max-height: none;
        padding-right: 0;
    }
    
    .template-gallery {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .main-nav {
        gap: 16px;
    }
    
    .site-main .container {
        padding: 20px;
        margin: 16px;
        border-radius: 8px;
    }
    
    #my-pages-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    #my-pages-list .page-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .features-grid,
    .info-cards-layout {
        grid-template-columns: 1fr;
    }
    
    .gallery-container {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .site-main .container {
        margin: 8px;
        padding: 16px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.template-card,
.editor-panel,
#my-pages-list li {
    animation: fadeIn 0.3s ease-out;
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}