:root {
--primary: #4f46e5;
--primary-hover: #4338ca;
--bg-color: #f3f4f6;
--card-bg: #ffffff;
--text-main: #1f2937;
--text-muted: #6b7280;
--border: #e5e7eb;
}

body {
font-family: 'Poppins', sans-serif;
background-color: var(--bg-color);
color: var(--text-main);
margin: 0;
padding: 40px 20px;
}

#container {
max-width: 1000px;
margin: 0 auto;
}

.tool-section {
display: none;
background: var(--card-bg);
padding: 40px;
border-radius: 16px;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
max-width: 600px;
margin: 0 auto;
text-align: center;
border: 1px solid var(--border);
}

#tools-wrapper {
display: block !important;
}

button {
background-color: var(--primary);
color: white;
border: none;
padding: 12px 24px;
font-size: 1rem;
font-family: 'Poppins', sans-serif;
font-weight: 600;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.2s;
margin-top: 15px;
}

button:hover {
background-color: var(--primary-hover);
}

input[type="text"], input[type="password"], select, input[type="number"] {
width: 100%;
max-width: 300px;
padding: 12px 16px;
margin: 10px 0;
border: 1px solid var(--border);
border-radius: 8px;
font-family: 'Poppins', sans-serif;
font-size: 1rem;
box-sizing: border-box;
transition: border-color 0.2s;
}

input[type="text"]:focus, select:focus {
outline: none;
border-color: var(--primary);
}

#nav-bar button {
background-color: #ffffff;
color: var(--text-main);
border: 1px solid var(--border);
margin-bottom: 20px;
}

#nav-bar button:hover {
background-color: #f9fafb;
}

input[type="file"] {
display: block;
margin-bottom: 10px;
}

#dashboard h1 {
text-align: center;
font-size: 2.5rem;
margin-bottom: 40px;
color: var(--text-main);
}

.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 24px;
}

.card {
background: var(--card-bg);
border: 1px solid var(--border);
padding: 30px 20px;
text-align: center;
text-decoration: none;
color: var(--text-main);
border-radius: 12px;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
display: flex;
flex-direction: column;
align-items: center;
}

.card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
border-color: var(--primary);
}

.card-icon {
font-size: 40px;
margin-bottom: 15px;
}

.card h3 {
margin: 0 0 8px 0;
font-size: 1.2rem;
}

.card p {
margin: 0;
font-size: 0.85rem;
color: var(--text-muted);
}

.tool-section h2 {
margin-top: 0;
margin-bottom: 24px;
}

.drop-zone {
border: 2px dashed #cbd5e1;
padding: 50px 20px;
background: #f8fafc;
border-radius: 12px;
margin-bottom: 20px;
transition: all 0.2s ease;
position: relative;
}

.drop-zone:hover, .drop-zone.dragover {
background: #eff6ff;
border-color: var(--primary);
}

.drop-zone p {
color: var(--text-muted);
font-weight: 600;
pointer-events: none;
}

.drop-zone input[type="file"] {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
cursor: pointer;
}

#editor-canvas-wrapper {
position: relative;
display: inline-block;
background: #fff;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#editor-canvas-wrapper canvas {
display: block;
}

.draggable-text {
position: absolute;
border: 1px dashed transparent;
padding: 2px;
white-space: nowrap;
outline: none;
cursor: move;
}

.draggable-text:hover, .draggable-text:focus {
border: 1px dashed #0282e5;
}

#add-text-sec {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
padding: 0 !important;
max-width: 100vw !important;
margin: 0 !important;
border: none !important;
border-radius: 0 !important;
box-shadow: none !important;
background-color: #0f172a;
z-index: 1000;
}

.studio-app-layout {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
text-align: left;
}

.studio-top-nav-container {
border-bottom: 1px solid #334155;
background: #0f172a;
height: 56px;
flex-shrink: 0;
}

.studio-top-nav {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
height: 100%;
}

.studio-logo {
display: flex;
align-items: center;
gap: 12px;
}

.studio-logo-title {
font-weight: 700;
font-size: 1.1rem;
color: #f8fafc;
}

.studio-nav-back {
background: transparent;
color: #cbd5e1;
border: 1px solid #334155;
padding: 6px 12px;
border-radius: 6px;
cursor: pointer;
font-size: 0.85rem;
margin: 0;
}

.studio-nav-back:hover {
background: #1e293b;
color: #fff;
}

.studio-nav-btn {
background: #3b82f6;
color: white;
border: none;
padding: 8px 16px;
border-radius: 6px;
cursor: pointer;
font-weight: 600;
margin: 0;
}

.studio-nav-btn:hover {
background: #2563eb;
}

.studio-main-shell {
flex: 1;
display: flex;
overflow: hidden;
position: relative;
background: #cbd5e1;
}

.studio-tool-rail {
width: 80px;
background: #1e293b;
border-right: 1px solid #334155;
display: flex;
flex-direction: column;
padding: 16px 0;
flex-shrink: 0;
overflow-y: auto;
z-index: 10;
}

.studio-tool-rail-section {
margin-bottom: 20px;
}

.studio-tool-rail-section-label {
font-size: 10px;
color: #94a3b8;
text-align: center;
margin-bottom: 8px;
letter-spacing: 1px;
font-weight: 600;
}

.studio-tool-rail-btn {
background: transparent;
border: none;
color: #cbd5e1;
width: 100%;
padding: 10px 0;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
font-size: 11px;
margin: 0;
border-radius: 0;
}

.studio-tool-rail-btn:hover {
background: rgba(255, 255, 255, 0.08);
color: #fff;
}

.studio-shell-canvas {
flex: 1;
background: #cbd5e1;
overflow: auto;
display: flex;
justify-content: center;
align-items: flex-start;
padding: 40px;
position: relative;
}

.studio-empty-state {
text-align: center;
color: #334155;
margin-top: 15vh;
}

.studio-empty-state h2 {
margin-bottom: 8px;
}

.studio-empty-state p {
color: #64748b;
font-size: 0.95rem;
}

.studio-upload-btn {
background: #3b82f6;
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
cursor: pointer;
font-weight: 600;
margin-top: 16px;
}

.studio-side-panel {
width: 300px;
background: #1e293b;
border-left: 1px solid #334155;
padding: 20px;
display: flex;
flex-direction: column;
color: white;
flex-shrink: 0;
}

.studio-side-panel select, .studio-side-panel button {
width: 100%;
padding: 8px 12px;
margin: 8px 0;
border-radius: 6px;
border: 1px solid #334155;
background: #0f172a;
color: white;
}

.studio-side-panel button {
background: #3b82f6;
cursor: pointer;
}

#editor-ocr-result {
flex: 1;
background: #0f172a;
border: 1px solid #334155;
border-radius: 6px;
padding: 12px;
color: #cbd5e1;
font-size: 12px;
overflow-y: auto;
white-space: pre-wrap;
min-height: 120px;
}

.draggable-image {
position: absolute;
resize: both;
overflow: hidden;
background-size: 100% 100%;
background-repeat: no-repeat;
border: 2px dashed transparent;
cursor: move;
}

.draggable-image:hover, .draggable-image:focus {
border: 2px dashed #3b82f6;
}

.whiteout-box, .redact-box, .draggable-image {
resize: none !important;
border: none !important;
outline: none !important;
}

.resize-node {
position: absolute;
width: 12px;
height: 12px;
background: #ffffff;
border: 2px solid #3b82f6;
border-radius: 50%;
z-index: 1000;
}

.resize-node[data-dir="nw"] { top: -6px; left: -6px; cursor: nwse-resize; }
.resize-node[data-dir="ne"] { top: -6px; right: -6px; cursor: nesw-resize; }
.resize-node[data-dir="sw"] { bottom: -6px; left: -6px; cursor: nesw-resize; }
.resize-node[data-dir="se"] { bottom: -6px; right: -6px; cursor: nwse-resize; }
.resize-node[data-dir="n"]  { top: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.resize-node[data-dir="s"]  { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.resize-node[data-dir="e"]  { top: calc(50% - 6px); right: -6px; cursor: ew-resize; }
.resize-node[data-dir="w"]  { top: calc(50% - 6px); left: -6px; cursor: ew-resize; }

body[data-theme="dark"] {
--bg-color: #121212;
--card-bg: #1e1e1e;
--text-main: #f3f4f6;
--text-muted: #9ca3af;
--border: #374151;
}

body[data-theme="pastel-pink"] {
--bg-color: #fff0f5;
--card-bg: #ffe4e1;
--text-main: #4a0404;
--text-muted: #8b5a2b;
--border: #ffb6c1;
--primary: #ff69b4;
--primary-hover: #ff1493;
}

body[data-theme="pastel-blue"] {
--bg-color: #f0f8ff;
--card-bg: #e6e6fa;
--text-main: #00008b;
--text-muted: #4682b4;
--border: #b0e0e6;
--primary: #4169e1;
--primary-hover: #0000cd;
}

body[data-theme="pastel-green"] {
--bg-color: #f5fffa;
--card-bg: #f0fff0;
--text-main: #006400;
--text-muted: #2e8b57;
--border: #98fb98;
--primary: #3cb371;
--primary-hover: #2e8b57;
}

#opendesign-sec {
max-width: min(1700px, 98vw);
width: 98vw;
padding: 20px;
}

#opendesign-sec iframe {
height: calc(100vh - 130px) !important;
}