:root {
    --surface: #ffffff;
    --background: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --gradient-start: #3b82f6;
    --gradient-end: #1d4ed8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-3d: 0 20px 40px rgba(15, 23, 42, 0.15);
}

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

body {
    font-family: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background-color: var(--background);
    line-height: 1.5;
}

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

/* Header styling */
.header {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 20px;
    padding: 32px 40px;
    color: #ffffff;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
}

.header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.header p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    max-width: 680px;
}

.header-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.header-tools a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: opacity 0.2s;
}

.header-tools a:hover {
    opacity: 0.8;
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--shadow-md);
}

.panel h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 18px;
    color: var(--text);
    border-left: 4px solid var(--accent);
    padding-left: 10px;
    line-height: 1.2;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background-color: var(--accent-hover);
}

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

.btn.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn.btn-ghost:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* Form Fields */
.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #334155;
    margin-bottom: 6px;
}

.field select,
.field input,
.field textarea {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    color: var(--text);
    background-color: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field select:focus,
.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.field textarea {
    min-height: 120px;
    resize: vertical;
}

/* Notices */
.notice {
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.notice.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.notice.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

/* Theme Selection List */
.theme-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.theme-item {
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.theme-item:hover {
    border-color: #94a3b8;
}

.theme-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.theme-item strong {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.palette {
    display: flex;
    gap: 4px;
}

.swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Live Preview */
.preview {
    border-radius: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: #ffffff;
}

.preview-hero {
    padding: 60px 40px;
    text-align: center;
    transition: background 0.3s;
}

.preview-hero h3 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.025em;
}

.preview-hero p {
    font-size: 1.125rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.preview-body {
    padding: 40px;
    background: #ffffff;
}

.preview-body strong {
    display: block;
    font-size: 1.25rem;
    margin-bottom: 12px;
    color: var(--text);
}

.preview-body p {
    color: #475569;
    font-size: 1rem;
    margin-bottom: 24px;
    white-space: pre-line;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 6px 12px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background-color: #f1f5f9;
    font-size: 0.85rem;
    color: #475569;
    font-weight: 500;
}

.meta {
    color: var(--muted);
    font-size: 0.875rem;
}

/* Table Style for Projects */
.project-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.project-table th {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 600;
    text-align: left;
    padding: 14px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.project-table td {
    padding: 14px 16px;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
    background: #ffffff;
    color: #334155;
}

.project-table tr:last-child td {
    border-bottom: 0;
}

.status {
    display: inline-flex;
    align-items: center;
    border-radius: 99px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status.draft {
    color: #d97706;
    background: #fef3c7;
}

.status.published {
    color: #059669;
    background: #d1fae5;
}

.link-btn {
    border: 0;
    background: transparent;
    color: #dc2626;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.link-btn:hover {
    text-decoration: underline;
}

.backup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 16px 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.inline-form {
    display: inline-flex;
    gap: 10px;
    align-items: center;
}

.inline-form input[type="file"] {
    font-size: 0.85rem;
    color: var(--muted);
}

/* ==========================================
   3D & Animation Enhancements (New Section)
   ========================================== */

/* 3D Perspective Container for Templates grid */
.template-grid {
    perspective: 1200px;
}

/* 3D Card base styling */
.template-card {
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out, box-shadow 0.25s ease;
    will-change: transform;
}

.template-card:hover {
    box-shadow: var(--shadow-3d), 0 0 30px rgba(37, 99, 235, 0.15);
}

.card-header-gradient {
    transform-style: preserve-3d;
}

/* Parallax element popouts on card hover */
.industry-tag {
    transform: translateZ(25px);
}

.theme-name {
    transform: translateZ(40px);
}

.palette-wrap {
    transform: translateZ(15px);
}

/* Isometric 3D miniature website mockup inside template header */
.isometric-stage {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: rgba(15, 23, 42, 0.05);
    border-radius: 12px;
    margin-top: 14px;
    transform: translateZ(10px);
}

.isometric-browser {
    width: 140px;
    height: 120px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    transform: rotateX(55deg) rotateZ(-40deg) translateY(10px);
    transform-style: preserve-3d;
    position: relative;
    animation: isometricFloating 4s ease-in-out infinite;
}

/* Top bar of mock browser */
.isometric-browser-bar {
    height: 12px;
    background: #f1f5f9;
    border-bottom: 1.5px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding-left: 6px;
    gap: 3px;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
}

.dots {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #cbd5e1;
}

.dots.red { background-color: #ef4444; }
.dots.yellow { background-color: #eab308; }
.dots.green { background-color: #22c55e; }

/* 3D stacked layout layers */
.iso-layer {
    position: absolute;
    left: 8px;
    right: 8px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.25s ease;
}

.iso-layer.layer-hero {
    top: 20px;
    height: 28px;
    background: linear-gradient(135deg, var(--col1), var(--col2));
    transform: translateZ(15px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 6px;
}

.iso-layer.layer-hero::before {
    content: "";
    width: 60%;
    height: 4px;
    background: rgba(255,255,255,0.7);
    border-radius: 2px;
    margin-bottom: 3px;
}

.iso-layer.layer-hero::after {
    content: "";
    width: 40%;
    height: 3px;
    background: rgba(255,255,255,0.5);
    border-radius: 1.5px;
}

.iso-layer.layer-body {
    top: 54px;
    height: 34px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    transform: translateZ(30px);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.iso-layer.layer-body-line {
    height: 3px;
    background: #e2e8f0;
    border-radius: 1.5px;
}

.iso-layer.layer-chips {
    top: 94px;
    height: 16px;
    background: #ffffff;
    transform: translateZ(45px);
    display: flex;
    gap: 4px;
    padding: 3px 6px;
    border: 1px solid #e2e8f0;
}

.iso-layer.layer-chips .micro-chip {
    width: 14px;
    height: 8px;
    border-radius: 2px;
    background: #e2e8f0;
}

/* Isometric float animation */
@keyframes isometricFloating {
    0% {
        transform: rotateX(55deg) rotateZ(-40deg) translateY(10px) translateZ(0px);
        box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    }
    50% {
        transform: rotateX(55deg) rotateZ(-40deg) translateY(10px) translateZ(12px);
        box-shadow: 0 20px 35px rgba(0,0,0,0.22);
    }
    100% {
        transform: rotateX(55deg) rotateZ(-40deg) translateY(10px) translateZ(0px);
        box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    }
}

/* Live preview page (project_view.php) dynamic mesh aurora background */
.mesh-gradient {
    position: relative;
    background: linear-gradient(125deg, #1e3a8a, #0f172a, #311042);
    background-size: 300% 300%;
    animation: auroraMesh 16s ease infinite;
    overflow: hidden;
}

@keyframes auroraMesh {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Floating SVG 3D-like geometric shape decor */
.floating-shape {
    position: absolute;
    pointer-events: none;
    opacity: 0.18;
    z-index: 1;
    animation: shapeFloating 12s ease-in-out infinite alternate;
}

@keyframes shapeFloating {
    0% {
        transform: translateY(0px) rotate(0deg) scale(1);
    }
    50% {
        transform: translateY(-20px) rotate(180deg) scale(1.1);
    }
    100% {
        transform: translateY(10px) rotate(360deg) scale(0.95);
    }
}

/* Responsive grid */
@media (max-width: 1024px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px 12px 40px;
    }
    .header {
        padding: 24px 20px;
    }
    .project-table {
        display: block;
        overflow-x: auto;
    }
    .header-tools {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
