﻿/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.title {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(45deg, #ffd700, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    color: #a0a0a0;
    font-weight: 300;
}

/* Main content layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
    align-items: start;
}

/* Customizer panel */
.customizer-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.section {
    margin-bottom: 30px;
}

.section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #ffd700;
}

/* Border selector */
.border-selector {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.border-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    min-width: 100px;
}

.border-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.border-option.selected {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.border-option img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 8px;
}

.border-option span {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
}

/* Icon search and grid */
.icon-search {
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.15);
}

.search-input::placeholder {
    color: #a0a0a0;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.icon-item {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
}

.icon-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.icon-item.selected {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.icon-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.upload-item {
    font-size: 2rem;
    font-weight: bold;
    color: #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 215, 0, 0.1);
    border: 2px dashed rgba(255, 215, 0, 0.5);
}

.upload-item:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.8);
    transform: scale(1.05);
}

/* Form elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #e0e0e0;
}

.text-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    resize: vertical;
}

.text-input:focus {
    outline: none;
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.15);
}

.text-input::placeholder {
    color: #a0a0a0;
}

/* Rich Text Editor */
.rich-text-editor {
    width: 100%;
    min-height: 80px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    resize: vertical;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
    line-height: 1.4;
}

.rich-text-editor:focus {
    outline: none;
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.15);
}

.rich-text-editor:empty::before {
    content: attr(data-placeholder);
    color: #a0a0a0;
}

.rich-text-editor:focus:empty::before {
    content: attr(data-placeholder);
    color: #a0a0a0;
}

/* Download button */
.download-btn {
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.3);
}

/* Preview panel */
.preview-panel {
    position: sticky;
    top: 20px;
}

.preview-panel h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #ffd700;
    text-align: center;
}

/* Augment card */
.augment-card {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
}

.card-border {
    position: relative;
    width: 280px;
    height: 400px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-content {
    position: relative;
    width: 200px;
    height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;             /* stack items at the top */
    padding: 0 20px;
    text-align: center;
    gap: 10px;                               /* small gap for breathing room */
    word-break: break-word;      /* force-break long strings */
    overflow-wrap: break-word;
}

.card-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;         /* ensure wrapping is allowed */
}

.card-tags {
    display: flex;
    gap: 5px;
    margin-top: -10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    justify-content: center;
    overflow-wrap: break-word;
}

.tag {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
}

.card-description {
    font-size: 0.9rem;
    color: #e0e0e0;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;         /* ensure wrapping is allowed */
}

/* Responsive design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .preview-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .customizer-panel {
        padding: 20px;
    }
    
    .border-selector {
        justify-content: center;
    }
    
    .icon-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
    
    .icon-item {
        width: 50px;
        height: 50px;
    }
    
    .icon-item img {
        width: 40px;
        height: 40px;
    }
}

/* Scrollbar styling */
.icon-grid::-webkit-scrollbar {
    width: 8px;
}

.icon-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.icon-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.5);
    border-radius: 4px;
}

.icon-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.7);
}

/* Icon Controls */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #e0e0e0;
}

#manualControls label {
    display: block;
    margin: 8px 0;
    color: #e0e0e0;
    font-size: 0.9rem;
}

#manualControls input[type="range"] {
    width: 100%;
}

/* Drag and Resize */
.draggable {
    cursor: move;
    outline: 2px dashed rgba(255, 215, 0, 0.6); /* yellow dashed frame when editable */
    outline-offset: 2px;
    transition: outline 0.2s ease;
}

.draggable.selected {
    outline: 2px solid rgba(255, 255, 0, 0.9);  /* brighter when clicked/dragging */
}

.resizable {
    position: relative;
    min-width: 40px;       /* optional safe limits */
    min-height: 20px;
    cursor: move;          /* combined with drag */
}

.resizable::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: linear-gradient(-45deg, transparent 30%, rgba(255, 215, 0, 0.8) 30%, rgba(255, 215, 0, 0.8) 70%, transparent 70%);
    cursor: se-resize;
    border-radius: 2px;
}

/* Font Size Controls */
.font-controls {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.font-controls label {
    font-size: 0.9rem;
    color: #e0e0e0;
    min-width: 70px;
}

/* Color Formatting Controls */
.color-formatting-section {
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.color-formatting-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.color-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.color-picker {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.hex-input {
    width: 80px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #ffffff;
    font-size: 0.85rem;
    font-family: monospace;
    text-transform: uppercase;
}

.hex-input:focus {
    outline: none;
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.15);
}

.hex-input::placeholder {
    color: #a0a0a0;
    text-transform: none;
}

.color-label {
    font-size: 0.85rem;
    color: #a0a0a0;
}

.apply-color-btn {
    padding: 6px 12px;
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid #ffd700;
    border-radius: 4px;
    color: #ffd700;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.apply-color-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: translateY(-1px);
}

.apply-color-btn:active {
    transform: translateY(0);
}

.formatting-help {
    padding: 8px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 4px;
    border-left: 3px solid #ffd700;
}

.formatting-help small {
    color: #e0e0e0;
    line-height: 1.4;
    display: block;
}

.font-size-slider {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.font-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #ffd700;
    border-radius: 50%;
    cursor: pointer;
}

.font-size-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #ffd700;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.font-controls span {
    font-size: 0.9rem;
    color: #ffd700;
    min-width: 40px;
    text-align: right;
}

/* Prevent text selection while editing/dragging */
.card-content.editing {
    user-select: none;
}
