/* --- 1. Product Page Button --- */
#pad-open-btn {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white; border: none; padding: 18px 30px;
    font-size: 1.1rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    border-radius: 50px; box-shadow: 0 10px 20px rgba(168, 85, 247, 0.3);
    cursor: pointer; transition: all 0.3s ease;
    width: 100%; margin-bottom: 20px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
#pad-open-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(168, 85, 247, 0.4);
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
}

/* --- 2. Modal Overlay --- */
#pad-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(8px);
    z-index: 999999; display: flex; justify-content: center; align-items: center;
    opacity: 0; animation: padFadeIn 0.3s forwards;
}
@keyframes padFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- 3. Content Card --- */
.pad-content {
    background: #ffffff; width: 95%; max-width: 1000px; height: 90vh;
    display: flex; flex-direction: column; border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); overflow: hidden; position: relative;
}

.pad-head {
    padding: 15px 20px; background: #1e293b; color: #fff;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #334155;
}
.pad-head h3 { margin: 0; color: #fff; font-size: 1.1rem; font-weight: 600; display:flex; align-items:center; gap:10px; }
#pad-view-label { background: #3b82f6; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; text-transform: uppercase; }
#pad-close { font-size: 28px; cursor: pointer; color:#94a3b8; line-height: 1; transition: color 0.2s; }
#pad-close:hover { color: #fff; }

.pad-body {
    flex: 1; display: flex; flex-direction: column; background: #f1f5f9; position: relative; overflow: hidden;
}

/* Toolbar */
.pad-tools {
    display: flex; gap: 10px; padding: 12px 15px; background: #fff;
    border-bottom: 1px solid #e2e8f0; align-items: center; justify-content: center; flex-wrap: wrap; z-index: 2;
}

.pad-btn {
    padding: 10px 18px;
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
    border: 1px solid #cbd5e1;
    color: #475569;
    cursor: pointer;
    font-weight: 600; font-size: 0.9rem;
    border-radius: 8px;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.2s;
}
.pad-btn:hover { background: #f1f5f9; border-color: #94a3b8; transform: translateY(-1px); }
.pad-btn.red { color: #ef4444; border-color: #fca5a5; }

/* Controls Group */
.pad-group {
    display: flex; align-items: center; gap: 8px;
    background: #f8fafc; padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 8px;
}
.pad-label { font-size: 12px; font-weight: bold; color: #64748b; text-transform: uppercase; }

#pad-color {
    border: none; width: 34px; height: 34px; cursor: pointer; padding: 0; background: none;
    border-radius: 50%; overflow: hidden; border: 2px solid #e2e8f0;
}
#pad-font {
    padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px; height: 34px;
    font-size: 14px; color: #334155; background-color: #fff;
}

/* Color Swatches (New) */
.pad-swatches { display: flex; gap: 5px; }
.pad-swatch {
    width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ccc; cursor: pointer; transition: transform 0.2s;
}
.pad-swatch:hover { transform: scale(1.1); }
.pad-swatch.active { box-shadow: 0 0 0 2px #333; transform: scale(1.1); }

/* Canvas */
#pad-canvas-wrap {
    flex: 1; display: flex; justify-content: center; align-items: center; overflow: hidden; padding: 20px;
    background-image:
      linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
      linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
      linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.pad-foot { padding: 15px; background: #fff; border-top: 1px solid #e2e8f0; text-align: center; }
#pad-save {
    background: #10b981; color: white; border: none; padding: 12px 40px;
    font-size: 1rem; border-radius: 8px; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); transition: all 0.2s;
}
#pad-save:hover { background: #059669; transform: scale(1.02); }

#pad-loader {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background: rgba(255,255,255,0.9); display: none;
    justify-content: center; align-items: center; text-align: center; z-index: 100;
    flex-direction: column; gap: 15px;
}
.pad-loader-content { font-size: 1.2rem; font-weight: 700; color: #334155; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; } 100% { opacity: 0.6; } }

@media (max-width: 768px) {
    .pad-content { width: 100%; height: 100%; max-width: none; border-radius: 0; }
    .pad-tools {
        justify-content: flex-start; overflow-x: auto; white-space: nowrap; padding: 10px;
        -webkit-overflow-scrolling: touch;
    }
    .pad-tools::-webkit-scrollbar { display: none; }
    .pad-btn { flex: 0 0 auto; font-size: 0.8rem; padding: 8px 12px; }
    #pad-canvas-wrap { padding: 10px; background-color: #cbd5e1; }
    #pad-save { width: 100%; padding: 15px; }
}