/* 
   Scoping to .rcg-app ensures this CSS does NOT leak into your website's main theme 
*/
.rcg-app {
    --rcg-bg-toolbar: #ffffff;
    --rcg-text-toolbar: #1e293b;
    --rcg-accent: #3b82f6;       /* Vibrant Blue */
    --rcg-accent-hover: #2563eb;
    --rcg-success: #10b981;
    --rcg-border: #e2e8f0;
    
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--rcg-text-toolbar);
    
    /* Full screen scaling mechanism */
    width: 100%;
    height: 100vh;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--rcg-border);
    border-radius: 12px;
    background-color: #f1f5f9;
}

.rcg-app * {
    box-sizing: border-box;
}

/* --- Main Palette Workspace --- */
.rcg-palette {
    flex-grow: 1;
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
}

.rcg-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    transition: background-color 0.4s ease;
    position: relative;
    /* Default text color, gets overridden by JS based on brightness */
    color: #ffffff; 
}

/* Color Data Group */
.rcg-color-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(20px);
    animation: rcgFadeIn 0.5s forwards ease-out;
}

@keyframes rcgFadeIn {
    to { opacity: 1; transform: translateY(0); }
}

.rcg-hex {
    font-size: 2.2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    user-select: none;
    font-family: 'Courier New', Courier, monospace;
}

.rcg-hex:hover {
    transform: scale(1.1);
}

.rcg-hex:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.rcg-rgb {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
    letter-spacing: 1px;
}

/* Lock Button */
.rcg-lock-btn {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    transition: all 0.2s;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rcg-lock-btn:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.rcg-lock-btn:active {
    transform: scale(0.95);
}

.rcg-lock-btn svg {
    width: 28px;
    height: 28px;
}

/* The lock icon swaps based on state */
.rcg-lock-open { display: block; }
.rcg-lock-closed { display: none; }

.rcg-col.locked .rcg-lock-open { display: none; }
.rcg-col.locked .rcg-lock-closed { display: block; }
.rcg-col.locked .rcg-lock-btn { opacity: 1; }

/* Dark mode overrides (added dynamically by JS if color is light) */
.rcg-col.rcg-dark-text {
    color: #000000;
}
.rcg-col.rcg-dark-text .rcg-lock-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* --- Floating Toolbar --- */
.rcg-toolbar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--rcg-bg-toolbar);
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 40px;
    z-index: 50;
    border: 1px solid var(--rcg-border);
}

.rcg-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rcg-brand svg {
    width: 28px;
    height: 28px;
    color: var(--rcg-accent);
}

.rcg-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0;
    color: var(--rcg-text-toolbar);
    letter-spacing: -0.5px;
}

.rcg-title span { color: var(--rcg-accent); }

.rcg-subtitle {
    font-size: 0.75rem;
    color: #64748b;
    margin: 2px 0 0 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Buttons */
.rcg-actions {
    display: flex;
    gap: 12px;
}

.rcg-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    color: #ffffff;
}

.rcg-btn svg { width: 18px; height: 18px; }
.rcg-btn:active { transform: scale(0.95); }

.rcg-btn-primary { background-color: var(--rcg-accent); }
.rcg-btn-primary:hover { background-color: var(--rcg-accent-hover); box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3); }

.rcg-btn-success { background-color: var(--rcg-success); color: white; }
.rcg-btn-success:hover { background-color: #059669; box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3); }

/* Toast */
.rcg-toast {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: var(--rcg-text-toolbar);
    color: white;
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.rcg-toast.rcg-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 900px) {
    .rcg-app {
        height: auto;
        min-height: 100vh;
    }
    .rcg-palette {
        flex-direction: column;
    }
    .rcg-col {
        flex-direction: row;
        justify-content: space-around;
        padding: 30px 20px;
        min-height: 150px;
    }
    .rcg-color-info {
        flex-direction: row;
        gap: 20px;
    }
    .rcg-hex {
        font-size: 1.8rem;
    }
    .rcg-rgb { display: none; } /* Hide RGB on mobile for space */
    .rcg-toolbar {
        bottom: 20px;
        width: 90%;
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }
    .rcg-actions {
        width: 100%;
        flex-direction: column;
    }
    .rcg-btn { width: 100%; }
}