/* 
   Manxi Wallpaper Templates (Modern Aesthetic)
   Ratios: 16:9 (Desktop) & 9:16 (Mobile)
*/

:root {
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.3);
    --accent-color: #f3f3f3;
    --text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.wallpaper-canvas {
    position: relative;
    overflow: hidden;
    background: #000;
    color: #fff;
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Base Ratios */
.ratio-16-9 {
    width: 1920px;
    height: 1080px;
}

.ratio-9-16 {
    width: 1080px;
    height: 1920px;
}

/* --- Template 1: Editorial (The "Manxi Look") --- */
.tpl-editorial {
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    display: flex;
}

.tpl-editorial .main-img {
    position: absolute;
    right: 0;
    bottom: 0;
    height: 100%;
    width: 65%;
    object-fit: cover;
    object-position: center;
    filter: drop-shadow(-40px 0 60px rgba(0, 0, 0, 0.6));
    z-index: 2;
}

.tpl-editorial .bg-text {
    position: absolute;
    font-size: 320px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.06);
    line-height: 0.75;
    left: 40px;
    top: 50%;
    transform: translateY(-50%) skewY(-5deg);
    z-index: 1;
    white-space: nowrap;
    text-transform: uppercase;
}

.tpl-editorial .info-card {
    position: absolute;
    left: 100px;
    bottom: 100px;
    width: 500px;
    padding: 50px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(30px);
    border-left: 5px solid #fff;
    border-radius: 0 12px 12px 0;
    z-index: 3;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.tpl-editorial .name {
    font-size: 64px;
    letter-spacing: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #fff;
    display: inline-block;
}

.tpl-editorial .quote {
    font-size: 24px;
    font-weight: 300;
    line-height: 1.6;
    font-style: italic;
}

/* Mobile Adaptation for Editorial */
.ratio-9-16 .tpl-editorial {
    flex-direction: column;
}

.ratio-9-16 .tpl-editorial .main-img {
    width: 100%;
    height: 70%;
    bottom: 0;
}

.ratio-9-16 .tpl-editorial .info-card {
    left: 40px;
    top: 100px;
    bottom: auto;
    width: calc(100% - 80px);
}

/* --- Template 2: Modern Grid (The "Gallery Heart") --- */
.tpl-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 20px;
    padding: 40px;
    background: #0a0a0a;
}

.tpl-grid .grid-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tpl-grid .grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tpl-grid .center-panel {
    grid-column: 2 / 4;
    grid-row: 2 / 4;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(25px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
    border: 2px solid #fff;
    z-index: 10;
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

.tpl-grid .center-panel h2 {
    font-size: 48px;
    letter-spacing: 10px;
    margin-bottom: 10px;
}

/* --- Template 3: Zen Focus (The "Quiet Strength") --- */
.tpl-zen {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 80px;
    padding: 60px;
}

.tpl-zen .bg-glow {
    position: absolute;
    width: 1000px;
    height: 1000px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
}

.tpl-zen .main-focus {
    width: 450px;
    height: 650px;
    border-radius: 225px 225px 30px 30px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 2;
}

.tpl-zen .main-focus img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tpl-zen .content {
    max-width: 500px;
    z-index: 2;
    text-align: left;
}

.tpl-zen .quote-large {
    font-size: 42px;
    font-weight: 200;
    line-height: 1.6;
    position: relative;
    letter-spacing: 1px;
}

/* --- Template 4: Glass Prism (The "Dreamy Layer") --- */
.tpl-glass {
    background: #050505;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tpl-glass .blur-bg {
    position: absolute;
    width: 110%;
    height: 110%;
    background-size: cover;
    background-position: center;
    filter: blur(100px) brightness(0.4);
    opacity: 0.6;
}

.tpl-glass .prism-layers {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.tpl-glass .prism-card {
    position: absolute;
    width: 450px;
    height: 650px;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(255, 255, 255, 0.05);
}

.tpl-glass .prism-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
}

.tpl-glass .prism-card:nth-child(1) {
    transform: translateX(-250px) scale(0.85) rotate(-8deg);
    z-index: 1;
    filter: brightness(0.7) blur(2px);
}

.tpl-glass .prism-card:nth-child(3) {
    transform: translateX(250px) scale(0.85) rotate(8deg);
    z-index: 1;
    filter: brightness(0.7) blur(2px);
}

.tpl-glass .prism-card:nth-child(2) {
    transform: translateZ(50px);
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 500px;
    height: 720px;
}

.tpl-glass .prism-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%, rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
}

/* Mobile Adaptation for Glass Prism */
.ratio-9-16 .tpl-glass .prism-layers {
    flex-direction: column;
    gap: 20px;
}

.ratio-9-16 .tpl-glass .prism-card {
    width: 80vw;
    height: 40vh;
}

.ratio-9-16 .tpl-glass .prism-card:nth-child(2) {
    transform: scale(1.1);
}

/* --- Template 5: Fashion Cover (The "Vogue Vibe") --- */
.tpl-fashion {
    background: #fff;
    color: #000;
}

.tpl-fashion .vertical-text {
    position: absolute;
    left: 20px;
    top: 0;
    font-size: 300px;
    font-weight: 900;
    line-height: 0.8;
    color: #eee;
    writing-mode: vertical-lr;
    z-index: 1;
}

.tpl-fashion .main-cutout {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    height: 90%;
    z-index: 3;
    filter: drop-shadow(10px 10px 30px rgba(0, 0, 0, 0.2));
    object-fit: contain;
    width: 100%;
}

.tpl-fashion .overlay-text {
    position: absolute;
    right: 50px;
    top: 50px;
    text-align: right;
    z-index: 4;
}

.tpl-fashion .overlay-text h1 {
    font-size: 80px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -2px;
}

.tpl-fashion .overlay-text p {
    font-size: 20px;
    font-weight: 500;
    margin-top: 10px;
    text-transform: uppercase;
}

/* Mobile Adaptation for Fashion */
.ratio-9-16 .tpl-fashion .vertical-text {
    font-size: 150px;
}

.ratio-9-16 .tpl-fashion .overlay-text {
    right: 20px;
    top: 40px;
}

.ratio-9-16 .tpl-fashion .overlay-text h1 {
    font-size: 50px;
}

/* --- Template 6: Floating Polaroids (The "Memory Lane") --- */
.tpl-polaroids {
    background: #e0e0e0;
    background-image: radial-gradient(#ccc 1px, transparent 1px);
    background-size: 20px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tpl-polaroids .polaroid-stack {
    position: relative;
    width: 80%;
    height: 80%;
}

.tpl-polaroids .poly {
    position: absolute;
    background: white;
    padding: 15px 15px 60px 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid #ddd;
    transition: transform 0.3s;
}

.tpl-polaroids .poly img {
    width: 300px;
    height: 300px;
    object-fit: cover;
}

/* --- Template 7: Film Strip (The "Cinematic Story") --- */
.tpl-film {
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.tpl-film .strip {
    background: #111;
    padding: 40px 20px;
    display: flex;
    gap: 15px;
    border-top: 10px dashed #333;
    border-bottom: 10px dashed #333;
    position: relative;
}

.tpl-film .strip-item {
    width: 350px;
    height: 250px;
    background: #000;
    overflow: hidden;
}

.tpl-film .strip-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.3) contrast(1.1);
}

.tpl-film .strip-title {
    margin-top: 40px;
    font-size: 40px;
    letter-spacing: 15px;
    font-weight: 200;
    color: #555;
}

/* --- Template 8: Geometric Mosaic (The "Modern Edge") --- */
.tpl-mosaic {
    background: #111;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 20px;
    padding: 20px;
}

.tpl-mosaic .mosaic-item {
    position: relative;
    overflow: hidden;
    border-radius: 40px;
    border: 1px solid var(--glass-border);
}

.tpl-mosaic .mosaic-item:nth-child(1) {
    grid-row: span 2;
}

.tpl-mosaic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Template 9: Minimalist Duo (The "Pure Harmony") --- */
.tpl-duo {
    background: #fdfdfd;
    color: #222;
    display: flex;
    padding: 80px;
    gap: 60px;
}

.tpl-duo .duo-left {
    flex: 1.2;
    height: 100%;
    border-radius: 500px 500px 0 0;
    overflow: hidden;
    box-shadow: 20px 20px 60px #d9d9d9, -20px -20px 60px #ffffff;
}

.tpl-duo .duo-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tpl-duo .duo-small {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 30px;
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.1);
}

.tpl-duo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tpl-duo .text-block h2 {
    font-size: 60px;
    margin: 0;
    font-weight: 800;
    letter-spacing: -2px;
}

.tpl-duo .text-block p {
    font-size: 20px;
    opacity: 0.6;
    line-height: 1.6;
}

/* --- Template 10: Collage Frame (The "Detailed Focus") --- */
.tpl-frame {
    background: radial-gradient(circle, #222 0%, #000 100%);
    display: flex;
    justify-content: center;
    align-items: center;
}

.tpl-frame .main-frame {
    width: 600px;
    height: 800px;
    border: 20px solid #fff;
    border-radius: 100px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

.tpl-frame .detail-circles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.tpl-frame .circle {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 8px solid #fff;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.tpl-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Template 11: Instagram Style (The "Social Feed") --- */
.tpl-instagram {
    background: #000;
    position: relative;
    width: 100%;
    height: 100%;
}

.ig-post-container {
    background: #fff;
    color: #000;
    width: 800px;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.ig-post-container.scattered {
    transform-origin: center center;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.ig-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
}

.ig-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 1px solid #dbdbdb;
}

.ig-user-info {
    margin-left: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ig-username {
    font-weight: 700;
    font-size: 1.1rem;
}

.ig-location {
    font-size: 0.85rem;
    opacity: 0.8;
}

.ig-more {
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.ig-main-img {
    width: 800px;
    height: 800px;
    background: #fafafa;
}

.ig-main-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ig-footer {
    padding: 15px 20px 25px 20px;
}

.ig-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ig-left-actions {
    display: flex;
    gap: 15px;
}

.ig-icon {
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.ig-likes {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.ig-caption {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ig-time {
    font-size: 0.8rem;
    color: #8e8e8e;
    text-transform: uppercase;
}

/* Adaptation for Instagram */
.ratio-9-16 .ig-post-container.scattered {
    width: 90vw;
}

.ratio-9-16 .ig-main-img {
    width: 90vw;
    height: 90vw;
}

/* Adaptation for New Templates */
.ratio-9-16 .tpl-film .strip {
    flex-direction: column;
    height: 80%;
    width: auto;
}

.ratio-9-16 .tpl-film .strip-item {
    width: 80vw;
    height: 180px;
}

.ratio-9-16 .tpl-mosaic {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, 1fr);
}

.ratio-9-16 .tpl-duo {
    flex-direction: column;
    padding: 40px;
}

.ratio-9-16 .tpl-frame .main-frame {
    width: 80vw;
    height: 60vh;
}

.ratio-9-16 .tpl-frame .circle {
    width: 120px;
    height: 120px;
}

/* UI Controls for Wallpaper Module */
.wp-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
    background: var(--glass-bg);
    padding: 30px;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-group label {
    font-size: 0.9rem;
    opacity: 0.7;
    font-weight: 600;
    text-transform: uppercase;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.template-item {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    padding: 10px;
    transition: 0.3s;
}

.template-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.template-item.active {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.3);
}

.ratio-toggle {
    display: flex;
    gap: 10px;
}

.ratio-btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: #fff;
    cursor: pointer;
    transition: 0.3s;
}

.ratio-btn.active {
    background: #fff;
    color: #000;
}