* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background: #0f0f23;
            color: #ffffff;
            overflow: hidden;
        }

        .app-container {
            display: grid;
            grid-template-areas: 
                "header header header"
                "sidebar canvas tools";
            grid-template-columns: 320px 1fr 280px;
            grid-template-rows: 60px 1fr;
            height: 100vh;
        }

        /* Header */
        .header {
            grid-area: header;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.3);
            z-index: 1000;
        }

        .logo {
            font-size: 1.2rem;
            font-weight: 700;
            color: white;
        }

        .header-actions {
            display: flex;
            gap: 10px;
        }

        .header-btn {
            background: rgba(255,255,255,0.2);
            border: none;
            color: white;
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.9rem;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .header-btn:hover {
            background: rgba(255,255,255,0.3);
            transform: translateY(-1px);
        }

        .header-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        /* Sidebar */
        .sidebar {
            grid-area: sidebar;
            background: #1a1a2e;
            border-right: 1px solid #2d2d44;
            overflow-y: auto;
            scrollbar-width: thin;
            scrollbar-color: #3d3d5c #1a1a2e;
        }

        .sidebar::-webkit-scrollbar {
            width: 6px;
        }

        .sidebar::-webkit-scrollbar-track {
            background: #1a1a2e;
        }

        .sidebar::-webkit-scrollbar-thumb {
            background: #3d3d5c;
            border-radius: 3px;
        }

        .tab-container {
            display: flex;
            background: #16162a;
            border-bottom: 1px solid #2d2d44;
        }

        .tab {
            flex: 1;
            padding: 12px 8px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.85rem;
            border-bottom: 2px solid transparent;
        }

        .tab.active {
            background: #1a1a2e;
            border-bottom-color: #667eea;
            color: #667eea;
        }

        .tab:hover:not(.active) {
            background: #1f1f3a;
        }

        .tab-content {
            display: none;
            padding: 20px;
        }

        .tab-content.active {
            display: block;
        }

        .section {
            margin-bottom: 25px;
        }

        .section h3 {
            color: #a0a0c0;
            font-size: 0.9rem;
            font-weight: 600;
            margin-bottom: 15px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-group label {
            display: block;
            margin-bottom: 6px;
            color: #c0c0d0;
            font-size: 0.85rem;
            font-weight: 500;
        }

        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 10px 12px;
            background: #2d2d44;
            border: 1px solid #3d3d5c;
            border-radius: 6px;
            color: white;
            font-size: 0.9rem;
            transition: all 0.3s ease;
        }

        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
        }

        .form-group textarea {
            min-height: 80px;
            resize: vertical;
        }

        /* Template Grid */
        .template-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 20px;
        }

        .template-card {
            background: #2d2d44;
            border: 2px solid #3d3d5c;
            border-radius: 8px;
            padding: 15px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .template-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: var(--template-bg, linear-gradient(45deg, #667eea, #764ba2));
            opacity: 0.1;
            z-index: 1;
        }

        .template-card.active {
            border-color: #667eea;
            background: rgba(102, 126, 234, 0.1);
        }

        .template-card:hover {
            border-color: #7c8aed;
            transform: translateY(-2px);
        }

        .template-preview {
            width: 100%;
            height: 60px;
            background: var(--template-bg, linear-gradient(45deg, #667eea, #764ba2));
            border-radius: 4px;
            margin-bottom: 8px;
            position: relative;
            z-index: 2;
        }

        .template-name {
            font-size: 0.8rem;
            font-weight: 600;
            color: #e0e0f0;
            position: relative;
            z-index: 2;
        }

        /* Color and Style Controls */
        .color-grid {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 8px;
            margin-bottom: 15px;
        }

        .color-option {
            width: 35px;
            height: 35px;
            border-radius: 6px;
            cursor: pointer;
            border: 2px solid transparent;
            transition: all 0.3s ease;
            position: relative;
        }

        .color-option:hover {
            transform: scale(1.1);
        }

        .color-option.active {
            border-color: white;
            box-shadow: 0 0 0 2px #667eea;
        }

        .gradient-option {
            background: var(--gradient);
        }

        /* Range Sliders */
        .range-group {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .range-input {
            flex: 1;
            height: 6px;
            border-radius: 3px;
            background: #3d3d5c;
            outline: none;
            -webkit-appearance: none;
        }

        .range-input::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
            box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
        }

        .range-input::-moz-range-thumb {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
            border: none;
            box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
        }

        .range-value {
            background: #2d2d44;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 0.8rem;
            min-width: 45px;
            text-align: center;
            color: #e0e0f0;
        }

        /* Font Controls */
        .font-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-bottom: 15px;
        }

        .font-option {
            background: #2d2d44;
            border: 1px solid #3d3d5c;
            border-radius: 6px;
            padding: 8px;
            cursor: pointer;
            text-align: center;
            font-size: 0.8rem;
            transition: all 0.3s ease;
            color: #e0e0f0;
        }

        .font-option.active {
            border-color: #667eea;
            background: rgba(102, 126, 234, 0.2);
        }

        /* Canvas Area */
        .canvas-area {
            grid-area: canvas;
            background: #16162a;
            display: flex;
            flex-direction: column;
            padding: 20px;
            position: relative;
            overflow: auto;
        }

        /* Preview Controls */
        .preview-controls {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding: 15px 20px;
            background: #1a1a2e;
            border-radius: 10px;
            border: 1px solid #2d2d44;
        }

        .preview-mode-selector {
            display: flex;
            gap: 8px;
        }

        .preview-btn {
            background: #2d2d44;
            border: 1px solid #3d3d5c;
            color: #a0a0c0;
            padding: 10px 16px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .preview-btn:hover {
            background: #3d3d5c;
            color: white;
        }

        .preview-btn.active {
            background: #667eea;
            border-color: #667eea;
            color: white;
        }

        .preview-info {
            color: #a0a0c0;
            font-size: 0.9rem;
        }

        /* Side Selector */
        .side-selector {
            display: flex;
            gap: 8px;
            margin-bottom: 15px;
        }

        .side-btn {
            flex: 1;
            background: #2d2d44;
            border: 1px solid #3d3d5c;
            color: #a0a0c0;
            padding: 10px 12px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .side-btn:hover {
            background: #3d3d5c;
            color: white;
        }

        .side-btn.active {
            background: #667eea;
            border-color: #667eea;
            color: white;
        }

        /* Side Content */
        .side-content {
            display: none;
        }

        .side-content.active {
            display: block;
        }

        /* Canvas Container */
        .canvas-container {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            transform-origin: center;
            transition: transform 0.3s ease;
            min-height: 0;
            overflow: visible;
        }

        .canvas-container.dual-mode {
            align-items: flex-start;
            padding-top: 50px;
        }

        .canvas-container.threed-mode {
            align-items: center;
            justify-content: center;
        }

        /* Invitation Container */
        .invitation-container {
            position: relative;
            width: 500px;
            height: 700px;
        }

        /* Invitation Sides */
        .invitation {
            width: 100%;
            height: 100%;
            background: white;
            border-radius: 10px;
            box-shadow: 0 25px 50px rgba(0,0,0,0.4);
            position: absolute;
            top: 0;
            left: 0;
            overflow: hidden;
            transition: all 0.3s ease;
            opacity: 0;
            transform: scale(0.9);
            pointer-events: none;
        }

        .invitation.active {
            opacity: 1;
            transform: scale(1);
            pointer-events: all;
            z-index: 10;
        }

        /* Back Content Styles */
        .back-content {
            padding: 40px 30px;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .back-section {
            margin-bottom: 25px;
        }

        .back-section:last-child {
            margin-bottom: 0;
        }

        .back-section-title {
            font-size: 1.1rem;
            font-weight: 600;
            text-align: center;
            margin-bottom: 15px;
            letter-spacing: 1px;
            text-transform: uppercase;
        }

        .program-timeline {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .timeline-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 0;
            border-bottom: 1px solid rgba(0,0,0,0.1);
        }

        .timeline-item:last-child {
            border-bottom: none;
        }

        .timeline-item .time {
            font-weight: 600;
            min-width: 60px;
        }

        .timeline-item .event {
            flex: 1;
            text-align: right;
        }

        .contact-info {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .contact-item {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 0.9rem;
        }

        .contact-item i {
            width: 16px;
            text-align: center;
            opacity: 0.7;
        }

        .thank-you-message {
            text-align: center;
            font-style: italic;
            line-height: 1.6;
            margin-bottom: 20px;
            font-size: 0.95rem;
        }

        .signature {
            text-align: center;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .signature-names {
            font-weight: 600;
            font-size: 1.1rem;
        }

        .back-divider {
            width: 100px;
            height: 1px;
            background: linear-gradient(90deg, transparent, currentColor, transparent);
            margin: 15px auto;
            opacity: 0.3;
        }

        /* Program Item Controls */
        .program-item {
            display: grid;
            grid-template-columns: 1fr 2fr auto;
            gap: 10px;
            align-items: end;
            margin-bottom: 10px;
            padding: 10px;
            background: #2d2d44;
            border-radius: 6px;
        }

        .remove-program-item {
            background: #dc3545;
            border: none;
            color: white;
            padding: 8px;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .remove-program-item:hover {
            background: #c82333;
        }

        .add-btn {
            background: #28a745;
            border: none;
            color: white;
            padding: 10px 16px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .add-btn:hover {
            background: #218838;
        }

        /* Dual View */
        .dual-view-container {
            display: none;
            justify-content: center;
            align-items: flex-start;
            gap: 30px;
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
        }

        .dual-view-container.active {
            display: flex;
            position: relative;
            width: auto;
            height: auto;
        }

        .dual-card {
            position: relative;
            flex-shrink: 0;
        }

        .dual-label {
            position: absolute;
            top: -35px;
            left: 50%;
            transform: translateX(-50%);
            background: #667eea;
            color: white;
            padding: 6px 12px;
            border-radius: 4px;
            font-size: 0.8rem;
            font-weight: 600;
            z-index: 20;
            white-space: nowrap;
        }

        .dual-invitation {
            width: 300px;
            height: 420px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 15px 30px rgba(0,0,0,0.3);
            overflow: hidden;
            position: relative;
        }

        .dual-invitation .invitation-content {
            padding: 30px 20px;
            font-size: 0.7rem;
            transform: scale(0.6);
            transform-origin: top left;
            width: 166.67%;
            height: 166.67%;
        }

        .dual-invitation .couple-names {
            font-size: 2rem !important;
        }

        .dual-invitation .invitation-title {
            font-size: 0.8rem !important;
        }

        .dual-invitation .wedding-date {
            font-size: 0.9rem !important;
        }

        .dual-invitation .back-content {
            padding: 20px 15px;
            font-size: 0.6rem;
            transform: scale(0.6);
            transform-origin: top left;
            width: 166.67%;
            height: 166.67%;
        }

        .dual-invitation .back-section-title {
            font-size: 0.8rem !important;
        }

        /* 3D View */
        .threed-view-container {
            display: none;
            perspective: 1500px;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
        }

        .threed-view-container.active {
            display: flex;
            position: relative;
            width: auto;
            height: auto;
        }

        .threed-invitation {
            width: 400px;
            height: 560px;
            position: relative;
            transform-style: preserve-3d;
            animation: rotateCard 10s infinite linear;
            cursor: pointer;
        }

        .threed-invitation:hover {
            animation-play-state: paused;
        }

        .threed-front,
        .threed-back {
            position: absolute;
            width: 100%;
            height: 100%;
            backface-visibility: hidden;
            border-radius: 10px;
            box-shadow: 0 25px 50px rgba(0,0,0,0.4);
            background: white;
            overflow: hidden;
        }

        .threed-back {
            transform: rotateY(180deg);
        }

        .threed-front .invitation-content,
        .threed-back .invitation-content,
        .threed-back .back-content {
            padding: 25px 20px;
            font-size: 0.8rem;
            transform: scale(0.7);
            transform-origin: top left;
            width: 142.86%;
            height: 142.86%;
        }

        .threed-front .couple-names {
            font-size: 2.2rem !important;
        }

        .threed-front .invitation-title {
            font-size: 0.9rem !important;
        }

        .threed-back .back-section-title {
            font-size: 0.9rem !important;
        }

        @keyframes rotateCard {
            0% { transform: rotateY(0deg) rotateX(0deg); }
            25% { transform: rotateY(90deg) rotateX(5deg); }
            50% { transform: rotateY(180deg) rotateX(0deg); }
            75% { transform: rotateY(270deg) rotateX(-5deg); }
            100% { transform: rotateY(360deg) rotateX(0deg); }
        }

        .envelope-container {
            display: none;
            position: relative;
            margin-bottom: 30px;
        }

        .envelope-container.active {
            display: block;
        }

        .envelope {
            width: 500px;
            height: 300px;
            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
            border-radius: 8px;
            position: relative;
            box-shadow: 0 20px 40px rgba(0,0,0,0.3);
        }

        .envelope::before {
            content: '';
            position: absolute;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 0;
            height: 0;
            border-left: 250px solid transparent;
            border-right: 250px solid transparent;
            border-top: 150px solid #dee2e6;
            border-radius: 4px 4px 0 0;
        }

        .envelope-address {
            position: absolute;
            bottom: 60px;
            left: 50px;
            right: 50px;
            text-align: center;
            color: #495057;
            font-size: 0.9rem;
            line-height: 1.4;
        }

        .cutting-lines {
            position: absolute;
            top: -10px;
            left: -10px;
            right: -10px;
            bottom: -10px;
            pointer-events: none;
        }

        .cutting-line {
            position: absolute;
            background: #dc3545;
            opacity: 0.7;
        }

        .cutting-line.horizontal {
            height: 1px;
            left: 0;
            right: 0;
        }

        .cutting-line.vertical {
            width: 1px;
            top: 0;
            bottom: 0;
        }

        .cutting-line.top { top: 0; }
        .cutting-line.bottom { bottom: 0; }
        .cutting-line.left { left: 0; }
        .cutting-line.right { right: 0; }

        .invitation-container {
            position: relative;
        }

        .invitation {
            width: 500px;
            height: 700px;
            background: white;
            border-radius: 10px;
            box-shadow: 0 25px 50px rgba(0,0,0,0.4);
            position: relative;
            overflow: hidden;
            transition: all 0.3s ease;
        }

        .invitation-content {
            padding: 60px 50px;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            text-align: center;
            position: relative;
            z-index: 2;
        }

        .invitation-bg-pattern {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            opacity: 0.05;
            background-image: var(--bg-pattern);
            background-size: cover;
            z-index: 1;
        }

        .invitation-title {
            font-size: 1.2rem;
            font-weight: 300;
            letter-spacing: 3px;
            text-transform: uppercase;
            margin-bottom: 20px;
            opacity: 0.8;
        }

        .couple-names {
            font-size: 3rem;
            font-weight: 700;
            margin: 30px 0;
            line-height: 1.1;
            letter-spacing: 1px;
        }

        .wedding-date {
            font-size: 1.3rem;
            margin: 25px 0;
            font-weight: 400;
            letter-spacing: 1px;
        }

        .wedding-time {
            font-size: 1rem;
            margin: 15px 0;
            opacity: 0.8;
        }

        .wedding-location {
            font-size: 1.1rem;
            margin: 25px 0;
            line-height: 1.5;
            opacity: 0.9;
        }

        .invitation-message {
            font-size: 1rem;
            line-height: 1.7;
            margin: 30px 0;
            font-style: italic;
            opacity: 0.8;
        }

        .decorative-border {
            position: absolute;
            border: 2px solid currentColor;
            border-radius: 8px;
            opacity: 0.3;
        }

        .decorative-border.outer {
            top: 20px;
            left: 20px;
            right: 20px;
            bottom: 20px;
        }

        .decorative-border.inner {
            top: 40px;
            left: 40px;
            right: 40px;
            bottom: 40px;
        }

        .decorative-element {
            width: 80px;
            height: 2px;
            background: linear-gradient(90deg, transparent, currentColor, transparent);
            margin: 20px auto;
            opacity: 0.6;
        }

        .decorative-flourish {
            font-size: 2rem;
            margin: 15px 0;
            opacity: 0.4;
        }

        /* Tools Panel */
        .tools-panel {
            grid-area: tools;
            background: #1a1a2e;
            border-left: 1px solid #2d2d44;
            overflow-y: auto;
            scrollbar-width: thin;
            scrollbar-color: #3d3d5c #1a1a2e;
        }

        .tools-header {
            padding: 20px;
            border-bottom: 1px solid #2d2d44;
            background: #16162a;
        }

        .tools-content {
            padding: 20px;
        }

        .tool-section {
            margin-bottom: 25px;
        }

        .zoom-controls {
            display: flex;
            gap: 8px;
            margin-bottom: 15px;
        }

        .zoom-btn {
            background: #2d2d44;
            border: 1px solid #3d3d5c;
            color: white;
            padding: 8px 12px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.9rem;
        }

        .zoom-btn:hover {
            background: #3d3d5c;
        }

        .layers-list {
            max-height: 200px;
            overflow-y: auto;
        }

        .layer-item {
            background: #2d2d44;
            border: 1px solid #3d3d5c;
            border-radius: 6px;
            padding: 10px;
            margin-bottom: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .layer-item:hover {
            background: #3d3d5c;
        }

        .layer-item.active {
            border-color: #667eea;
            background: rgba(102, 126, 234, 0.2);
        }

        .layer-controls {
            display: flex;
            gap: 5px;
        }

        .layer-btn {
            background: none;
            border: none;
            color: #a0a0c0;
            padding: 4px;
            cursor: pointer;
            border-radius: 3px;
            transition: all 0.3s ease;
        }

        .layer-btn:hover {
            background: #3d3d5c;
            color: white;
        }

        /* Export Options */
        .export-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .export-btn {
            background: #2d2d44;
            border: 1px solid #3d3d5c;
            color: white;
            padding: 12px 8px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.85rem;
            text-align: center;
        }

        .export-btn:hover {
            background: #667eea;
            border-color: #667eea;
        }

        /* Animation Classes */
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }

        .saving {
            animation: pulse 1.5s infinite;
        }

        /* Responsive */
        @media (max-width: 1200px) {
            .app-container {
                grid-template-columns: 280px 1fr 240px;
            }
        }

        @media (max-width: 768px) {
            .app-container {
                grid-template-areas: 
                    "header"
                    "canvas"
                    "sidebar";
                grid-template-columns: 1fr;
                grid-template-rows: 60px 1fr auto;
            }
            
            .sidebar,
            .tools-panel {
                position: fixed;
                bottom: -100%;
                left: 0;
                right: 0;
                height: 60vh;
                transition: bottom 0.3s ease;
                z-index: 1001;
            }
            
            .sidebar.open,
            .tools-panel.open {
                bottom: 0;
            }
        }

        /* Custom Scrollbars */
        .tools-panel::-webkit-scrollbar {
            width: 6px;
        }

        .tools-panel::-webkit-scrollbar-track {
            background: #1a1a2e;
        }

        .tools-panel::-webkit-scrollbar-thumb {
            background: #3d3d5c;
            border-radius: 3px;
        }