/* RESET & CORE */
* { box-sizing: border-box; }
body, html {
    margin: 0; padding: 0;
    height: 100%; width: 100%;
    overflow: hidden; /* Prevent body scroll */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1a1a1a;
}
/* Container Fixes */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.tool-tray {
    flex: 1;
    background: #395763;
    overflow-y: auto;
    padding-bottom: 80px; /* Leave space for Nav Bar */
}

/* Tab Panels */
.tab-panel {
    display: none;
    padding: 20px;
    color: #fff;
}

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

/* Fixed Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 70px;
    background: white;
    display: flex;
    border-top: 1px solid #ddd;
    z-index: 1000;
}

.bottom-nav button {
    flex: 1;
    background: none;
    border: none;
    font-size: 11px;
    padding: 5px;
    color: #666;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.bottom-nav button:hover, .bottom-nav button.active {
    color: #395763;
    background: #f8f9fa;
}

/* Upload Area placeholder */
.upload-area {
    border: 2px dashed #ccc;
    padding: 40px;
    text-align: center;
    border-radius: 10px;
    background: #fafafa;
    color: #000;
}
/* CANVAS VIEWPORT (Top 45%) */
.canvas-viewport {
    flex: 0 0 45%;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.canvas-container {
    background: #fff !important;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* TOOL TRAY (Bottom 55%) */
.tool-tray {
    flex: 1;
    background: #395763;
    border-radius: 25px 25px 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.3);
    z-index: 10;
}

.tray-handle {
    width: 40px; height: 5px;
    background: #395763; border-radius: 10px;
    margin: 12px auto;
}

.tray-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 40px 20px;
}

/* SECTION STYLING */
.tray-section { margin-bottom: 25px; border-bottom: 1px solid #eee; padding-bottom: 20px; }
.tray-section label { display: block; font-weight: bold; margin-bottom: 8px; color: #fff; }

.input-row { display: flex; gap: 8px; margin-bottom: 10px; }
input[type="text"], input[type="email"], textarea {
    flex: 1; padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 16px;
}

button {
    padding: 7px 9px; border: none; border-radius: 8px; 
    font-weight: bold; cursor: pointer; background: #eee;
}

.primary-color { width: 45px; background: #fff; color: #000; margin-bottom: 5px;}

.primary-btn { background: #fff; color: #000; margin-bottom: 5px;}
#submitBtn { width: 100%; background: #28a745; color: white; margin-top: 10px; }

/* GRAPHICS GRID */
.graphics-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.graphics-grid img { width: 100%; border-radius: 4px; border: 1px solid #eee; }

/* FLOATING ACTION BUTTONS */
.fab-group {
    position: absolute; right: 15px; top: 15px;
    display: flex; flex-direction: column; gap: 10px; z-index: 20;
}
.fab {
    width: 45px; height: 45px; border-radius: 50%;
    background: #395763; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    font-size: 20px; display: flex; align-items: center; justify-content: center;
}

/* PALETTE POPUP */
.palette-popup {
    display: none; grid-template-columns: repeat(5, 1fr); gap: 5px;
    background: white; border: 1px solid #ddd; padding: 10px;
    position: absolute; z-index: 100; border-radius: 8px;
}
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 1px solid #ccc; }
.canvas-viewport {
    flex: 0 0 45%;
    background: #cbd5e1;
    display: flex;
    flex-direction: column; /* Stack toolbar above canvas */
    align-items: center;
    justify-content: center;
    position: relative;
}

.canvas-toolbar {
    position: absolute;
    top: 10px;
    display: flex;
    gap: 10px;
    z-index: 50;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px;
    border-radius: 12px;
    backdrop-filter: blur(5px); /* Modern glass effect */
}

.canvas-toolbar button {
    padding: 8px 12px;
    font-size: 13px;
    background: #395763;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.canvas-toolbar .danger-btn {
    color: #ff4d4d;
}

/* Ensure the canvas doesn't overlap the toolbar on small screens */
#canvasScaler {
    margin-top: 30px; 
}
/* 1. SQUARED TOOL TRAY */
.tool-tray {
    flex: 1;
    background: #395763;
    border-radius: 0; /* Removed rounding */
    display: flex;
    flex-direction: column;
    border-top: 2px solid #ddd; /* Adds a sharp definition line */
    z-index: 10;
}

/* 2. REMOVE THE HANDLE (No longer needed for squared design) */
.tray-handle {
    display: none;
}

/* 3. HIGH-CONTRAST ACTIVE TABS */
.bottom-nav button {
    flex: 1;
    background: none;
    border: none;
    border-top: 4px solid transparent; /* Placeholder for active line */
    font-size: 11px;
    font-weight: 600;
    color: #888;
    transition: all 0.3s ease;
}

/* THE "OBVIOUS" ACTIVE STATE */
.bottom-nav button.active {
    color: #395763; /* Bright Blue */
    background: #f0f7ff; /* Very light blue background tint */
    border-top: 4px solid #395763; /* Bold blue line at the top */
}

/* Ensure icons/emojis in active tabs pop */
.bottom-nav button.active span {
    filter: drop-shadow(0 0 2px rgba(0,123,255,0.3));
}
/* --- TEXT ALIGNMENT ROW --- */
.alignment-row {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    width: 100%;
}

.btn-align {
    flex: 1;
    height: 48px; /* Taller for mobile thumbs */
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Hover and Active states for the alignment buttons */
.btn-align:active {
    background-color: #f0f7ff;
    border-color: #395763;
    transform: scale(0.95); /* Slight "press" effect */
}

.btn-align svg {
    width: 24px;  /* Larger icons for mobile visibility */
    height: 24px;
    fill: #444;   /* Matches your tray labels */
}

/* Specific styling for the primary-btn to ensure spacing */
.primary-btn {
    margin-top: 10px;
    width: 100%;
    height: 50px;
    background: #fff;
    color: #000;
    font-size: 16px;
}
/* The container for the whole gallery */
.graphics-grid {
    display: grid; 
    grid-template-columns: repeat(3, 1fr); /* 3 items per row */
    gap: 10px; 
    padding: 10px 0;
}

/* The individual image wrapper (if you use one) or the image itself */
.graphics-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;    /* FORCES a perfect square */
    object-fit: contain;     /* Fits the whole graphic inside without cropping */
    background: #f8f9fa;    /* Light grey background for transparency visibility */
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 5px;           /* Padding so the graphic doesn't touch the edges */
    cursor: pointer;
    transition: transform 0.2s;
}

.graphics-grid img:active {
    transform: scale(0.95);
    background: #e9ecef;
}
