/* Consistent body styling */
body {
    background: #FFE9EF;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.user-page-container {
    min-height: 100vh;
    transition: all 0.3s ease;
    position: relative;
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 3px solid #ff69b4;
    margin-bottom: 30px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid #ff69b4;
    object-fit: cover;
}

.user-details h1 {
    margin: 0;
    color: #ff1493;
    font-size: 2.5em;
}

.user-url {
    margin: 5px 0 0 0;
    color: #8a2be2;
    font-weight: bold;
    font-size: 1.1em;
}

.home-link {
    background: linear-gradient(45deg, #ff69b4, #8a2be2);
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: bold;
    transition: transform 0.2s ease;
}

.home-link:hover {
    transform: scale(1.05);
}

.user-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.action-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    background: white;
    border: 3px solid #ddd;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1em;
    transition: all 0.2s ease;
    color: #666;
}

.tab-btn:hover {
    border-color: #ff69b4;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: linear-gradient(45deg, #ff69b4, #8a2be2);
    color: white;
    border-color: #ff69b4;
}

.tab-section {
    display: none;
}

.tab-section.active {
    display: block;
}

.form-container {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ff69b4;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(255, 105, 180, 0.2);
}

.form-container h2 {
    color: #ff1493;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2em;
}

.form-container p {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

#messageText {
    width: 100%;
    min-height: 120px;
    padding: 20px;
    border: 2px solid #ff69b4;
    border-radius: 20px;
    font-family: inherit;
    font-size: 16px;
    resize: vertical;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

#messageText:focus {
    outline: none;
    border-color: #8a2be2;
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.3);
}

.char-counter {
    text-align: right;
    margin: 10px 0;
    color: #666;
    font-size: 14px;
}

.send-btn, .send-drawing-btn {
    width: 100%;
    background: linear-gradient(45deg, #ff69b4, #ff1493);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 30px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(255, 20, 147, 0.3);
}

.send-btn:hover, .send-drawing-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(255, 105, 180, 0.4);
}

.send-btn:disabled, .send-drawing-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.drawing-area {
    text-align: center;
}

.drawing-toolbar {
    background: #f8f8f8;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    border-color: #ff69b4;
    transform: scale(1.05);
}

.tool-btn.active {
    background: #ff69b4;
    color: white;
    border-color: #ff69b4;
}

.color-presets {
    display: flex;
    gap: 4px;
}

.color-preset {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: transform 0.2s ease;
}

.color-preset:hover {
    transform: scale(1.2);
    border-color: #333;
}

#colorPicker {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
}

#brushSize {
    width: 100px;
}

#sizeDisplay {
    min-width: 40px;
    font-size: 12px;
    color: #666;
    font-weight: bold;
}

#drawingCanvas {
    border: 3px solid #ff69b4;
    border-radius: 15px;
    background: white;
    cursor: crosshair;
    margin: 10px 0;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.2);
}

.drawing-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.drawing-controls button {
    background: white;
    border: 2px solid #ff69b4;
    color: #ff69b4;
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.drawing-controls button:hover {
    background: #ff69b4;
    color: white;
    transform: scale(1.05);
}

.status-message {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
}

.status-message.success {
    background: #d1edff;
    color: #0c5460;
    border: 2px solid #bee5eb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.user-footer {
    text-align: center;
    padding: 40px 20px;
    color: #8a2be2;
    font-weight: bold;
}

.user-footer a {
    color: #ff1493;
    text-decoration: none;
}

.user-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .user-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        padding: 30px; /* Keep desktop padding */
    }
    
    .user-details h1 {
        font-size: 2.5em; /* Keep desktop font size */
    }
    
    .form-container {
        padding: 30px; /* Keep desktop padding */
        margin: 0 10px;
    }
    
    .action-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .tab-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .drawing-toolbar {
        flex-direction: column;
        gap: 20px; /* Keep desktop gap */
    }
    
    #drawingCanvas {
        width: 100%;
        height: 250px;
    }
    
    .drawing-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .drawing-controls button {
        flex: 1;
        min-width: 80px;
    }
}

/* Drag and Drop Styles */
.draggable-container {
    position: relative;
    cursor: move;
    user-select: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.draggable-container:hover {
    box-shadow: 0 4px 20px rgba(255, 105, 180, 0.3);
}

.draggable-container.dragging {
    opacity: 0.8;
    z-index: 1000;
    transform: rotate(2deg);
    box-shadow: 0 8px 30px rgba(255, 105, 180, 0.4);
}

.drag-handle {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(45deg, #ff69b4, #ff1493);
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.draggable-container:hover .drag-handle {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

.user-main {
    position: relative;
    min-height: 500px;
}

/* Drop zone styling */
.drop-zone {
    border: 2px dashed #ff69b4;
    background: rgba(255, 105, 180, 0.1);
    border-radius: 15px;
    padding: 20px;
}

.drop-zone.drag-over {
    border-color: #ff1493;
    background: rgba(255, 105, 180, 0.2);
}

/* Customization Panel */
.customization-panel {
    background: linear-gradient(45deg, #ff69b4, #ff1493);
    color: white;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.3);
}

.customize-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 14px;
}

.customize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.customize-help {
    font-size: 14px;
    opacity: 0.9;
    font-style: italic;
}

@media (max-width: 768px) {
    .customization-panel {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .customize-help {
        font-size: 12px;
    }
}

/* Published Page Elements */
.custom-page-canvas {
    position: relative;
    min-height: 600px;
    background: white;
    overflow: hidden;
}

.published-element {
    position: absolute;
    min-width: 50px;
    min-height: 30px;
}

.published-element .text-element {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 105, 180, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 16px;
    color: #333;
    text-align: center;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.published-element .image-element {
    overflow: hidden;
    border: 1px solid rgba(255, 105, 180, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    width: 100%;
    height: 100%;
}

.published-element .image-element img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.published-element .form-element {
    background: rgba(255, 255, 255, 0.98);
    padding: 25px;
    border-radius: 15px;
    border: 4px solid #ff69b4;
    box-shadow: 0 6px 25px rgba(255, 105, 180, 0.2);
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    min-width: 700px;
    min-height: 650px;
}

.published-element .form-element h3 {
    margin-top: 0;
    color: #ff1493;
    text-align: center;
}

.published-element .form-element textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 3px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.published-element .form-element canvas {
    border: 3px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: crosshair;
    display: block;
    margin: 10px auto;
}

.published-element .form-element button {
    background: linear-gradient(45deg, #ff69b4, #ff1493);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    padding: 10px 20px;
    width: 100%;
    margin-top: 10px;
    transition: all 0.2s ease;
}

.published-element .form-element button:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.4);
}

/* Advanced Scribble Toolbar Styles */
.scribble-toolbar {
    background: #f8f8f8;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    align-items: center;
    justify-items: center;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-group label {
    font-weight: bold;
    color: #333;
    font-size: 14px;
    margin-right: 5px;
}

.tool-btn {
    width: auto;
    height: 35px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    padding: 6px 12px;
    transition: all 0.2s ease;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.tool-btn:hover {
    border-color: #ff69b4;
    transform: scale(1.05);
}

.tool-btn.active {
    background: #ff69b4;
    color: white;
    border-color: #ff69b4;
}

.color-presets {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.color-preset {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: transform 0.2s ease;
}

.color-preset:hover {
    transform: scale(1.2);
    border-color: #333;
}

.tool-group input[type="color"] {
    width: 35px;
    height: 35px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.tool-group input[type="range"] {
    width: 100px;
}

.tool-group input[type="number"] {
    width: 50px;
    height: 30px;
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 4px;
    text-align: center;
    font-size: 12px;
}

.tool-group span {
    font-size: 12px;
    color: #666;
    font-weight: bold;
}

.scribble-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.scribble-controls button {
    background: white;
    border: 2px solid #ff69b4;
    color: #ff69b4;
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    font-size: 14px;
}

.scribble-controls button:hover {
    background: #ff69b4;
    color: white;
    transform: scale(1.05);
}

/* Disable canvas scaling */
.published-element .form-element canvas {
    width: 600px !important;
    height: 400px !important;
    max-width: none !important;
    max-height: none !important;
}

@media (max-width: 1000px) {
    .published-element .form-element {
        min-width: 90vw;
        min-height: 600px;
    }
    
    .scribble-toolbar {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }
    
    .tool-group {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .published-element .form-element canvas {
        width: 100% !important;
        max-width: 600px !important;
        height: auto !important;
        aspect-ratio: 3/2;
    }
}

@media (max-width: 768px) {
    /* Keep form elements at consistent size for 1:1 experience */
    .published-element .form-element {
        min-width: 90vw;
        min-height: 550px;
        padding: 20px; /* Keep desktop padding */
    }
    
    .scribble-controls {
        flex-direction: column;
        align-items: center;
        gap: 10px; /* Keep consistent gap */
    }
    
    .scribble-controls button {
        width: 100%;
        max-width: 250px;
    }
    
    /* Keep canvas at desktop size for 1:1 experience */
    .published-element .form-element canvas {
        width: 525px !important; /* Match desktop canvas size */
        height: 375px !important; /* Match desktop canvas size */
        max-width: 100vw !important; /* Allow horizontal scroll if needed */
    }
}

@media (max-width: 480px) {
    /* Keep canvas at desktop size for true 1:1 experience */
    .published-element .form-element canvas {
        width: 525px !important; /* Same as desktop */
        height: 375px !important; /* Same as desktop */
        max-width: 100vw !important; /* Allow horizontal scroll */
    }
    
    /* Keep tool controls at desktop size */
    .tool-group input[type="range"] {
        width: 100px; /* Keep closer to desktop size */
    }
    
    /* Keep color presets at desktop size */
    .color-presets {
        gap: 5px; /* Keep desktop spacing */
    }
    
    .color-preset {
        width: 25px; /* Keep desktop size */
        height: 25px;
    }
}