:root {
    --toolbar-height: 80px;
    --color-text-light: rgba(255,255,255,0.9);
    --color-text-dark: rgba(0,0,0,0.9);
    --modal-bg: rgba(255,255,255,0.98);
    --action-hover: rgba(255,255,255,0.2);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #333;
    overflow-x: hidden;
}

.color-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: var(--toolbar-height);
    border-bottom: 1px solid #f0f0f0;
    z-index: 10;
}

.toolbar-left h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: #333;
}

.space-prompt {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.space-prompt span {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.toolbar-right {
    display: flex;
    gap: 15px;
}

.tool-btn {
    background: none;
    border: none;
    color: #444;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: #f5f5f5;
    color: #000;
}

.tool-btn i {
    font-size: 14px;
}

.palette-scroll {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
}

.palette-container {
    display: flex;
    height: calc(100vh - var(--toolbar-height));
    min-width: fit-content;
}

.color-column {
    flex: 1;
    min-width: 120px;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.color-preview {
    flex: 1;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 10vh;
}

.color-info {
    color: white;
    text-align: center;
    user-select: all;
    cursor: text;
}

.color-hex {
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 30px;
    font-weight: 500;
    margin-bottom: 2vh;
    text-transform: uppercase;
}

.color-name {
    font-size: 14px;
    opacity: 1;
}

.color-actions {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: rgba(0,0,0,0.5);
    padding: 15px;
    border-radius: 8px;
}

.color-column:hover .color-actions {
    opacity: 1;
}

.color-action-btn {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.color-action-btn:hover {
    background: var(--action-hover);
}

.color-action-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.color-action-btn:hover::before {
    opacity: 1;
}

.add-color-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    color: #333;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    opacity: 0;
    transition: all 0.2s ease;
}

.add-color-btn.left {
    left: -20px;
}

.add-color-btn.right {
    right: -20px;
}

.color-column:hover .add-color-btn.left,
.color-column:hover .add-color-btn.right {
    display: flex;
    opacity: 1;
}

.add-color-btn:hover {
    background: #f0f0f0;
    transform: translateY(-50%) scale(1.1);
}

.add-color-btn i {
    font-size: 18px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--modal-bg);
    border-radius: 8px;
    width: 90vw;              /* Responsive width */
    max-width: 400px;         /* Maximum width */
    aspect-ratio: 1 / 1;      /* Makes it a square */
    max-height: 90vh;         /* Prevents overflow on small screens */
    overflow-y: auto;
    padding: 32px;            /* Equal top/bottom/left/right padding */
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    background: none;
}

.close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    margin: 0;
    line-height: 1;
    box-shadow: none;
    outline: none;
    transition: color 0.15s;
}
.close:hover, .close:focus {
    color: #111;
}

/* Color Card Modal */
.mini-palette {
    display: flex;
    height: auto; /* allow height to grow */
    border-radius: 6px;
    overflow: hidden;
    margin: 10px 0;
    padding: 0 20px; /* optional horizontal padding */
}

.mini-color-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mini-color {
    width: 100%;
    height: 100vh;
}

.mini-hex {
    color: black;
    font-family: monospace;
    font-size: 14px;
    font-weight: 500;
    margin-top: 8px;
    text-transform: uppercase;
}

.mini-name {
    color: black; /* always black */
    font-size: 12px;
    font-weight: 400;
    opacity: 1;
    margin-top: 2px;
}


/* Color Picker Modal */
.color-picker-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.color-picker-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#color-picker-input {
    width: 100px;
    height: 100px;
    border: none;
    cursor: pointer;
    padding: 0;
}

#color-picker-input::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

#color-picker-input::-moz-color-swatch {
    border: none;
    border-radius: 8px;
}

.hex-input {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 250px;
}

.hex-input label {
    font-weight: 600;
    min-width: 40px;
}

.hex-input input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    flex: 1;
    text-transform: uppercase;
}

.btn-save {
    background: #4a6fa5;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
    width: 100%;
    max-width: 250px;
}

.btn-save:hover {
    background: #3a5a80;
}

/* Modal overlay */
#save-modal.modal {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.18);
  justify-content: center;
  align-items: center;
}

/* Modal content */
.save-modal-content {
  background: var(--modal-bg, #fff);
  border-radius: 12px;
  width: 320px;
  padding: 32px 24px 24px 24px;
  box-shadow: 0 5px 30px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Modal header */
.save-modal-content .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border: none;
  padding: 0;
}

/* Close button */
.save-modal-content .close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
  padding: 0;
  margin: 0;
  line-height: 1;
  transition: color 0.15s;
}
.save-modal-content .close:hover { color: #222; }

/* Undo/Redo options */
.controls button {
  margin-right: 10px;
  padding: 8px 16px;
  font-weight: bold;
  cursor: pointer;
  border-style: hidden;
  background: none;
}

.controls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Save options */
.save-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}
.save-option {
  background: #f5f5f5;
  border: none;
  border-radius: 6px;
  padding: 16px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  color: #333;
}
.save-option:hover, .save-option:focus {
  background: #22223B;
  color: #fff;
}

/* Contrast and Shades Popovers */
.popover {
    position: absolute;
    background: white;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    padding: 15px;
    z-index: 10;
    display: none;
    width: 300px;
    left: 50%;
    transform: translateX(-50%);
    top: 50%;
}

.popover-colors {
    display: flex;
    gap: 5px;
}

.popover-color {
    flex: 1;
    height: 60px;
    border-radius: 4px;
    position: relative;
}

.popover-label {
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    color: var(--popover-label-color, white);
    font-size: 12px;
    text-align: center;
}

@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        height: auto;
        padding: 15px;
        gap: 10px;
    }
    
    .toolbar-left, .toolbar-right {
        width: 100%;
    }
    
    .toolbar-right {
        justify-content: flex-end;
    }
    
    .color-hex {
        font-size: 24px;
    }
    
    .color-name {
        font-size: 12px;
    }
    
    .color-action-btn {
        width: 36px;
        height: 36px;
    }
    
    .add-color-btn {
        width: 36px;
        height: 36px;
    }
    
    .add-color-btn.left {
        left: -18px;
    }
    
    .add-color-btn.right {
        right: -18px;
    }
    
    #color-picker-input {
        width: 80px;
        height: 80px;
    }
}

/* Previous styles remain the same, just adding new styles for the add button tooltips */

.add-color-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.add-color-btn:hover::before {
    opacity: 1;
}