/* ==== Variabel Global ==== */
:root {
    --bg-dark: #012633;      
    --sidebar-hover: #334155;  
    --sidebar-border: #1E293B;   

    --bg-sidebar-start: #475569; 
    --bg-sidebar-mid: #1e293b;  
    --bg-sidebar-end: #0f172a;  

    --bg-light: #f9fafb;
    --surface: #ffffff;
    --border-color: #e5e7eb;
    --border-medium: #d1d5db;
    --text-dark: #1f2937;
    --text-medium: #6b7280;
    --text-light: #9ca3af;
    
    /* Warna Aksen Utama (Teal) */
    --accent: #14b8a6;
    --accent-hover: #0d9488;
    --accent-light-bg: #f0fdfa;
    --accent-light-border: #a7f3d0;
    --accent-text: #0f766e;
}

/* ==== Pengaturan Dasar ==== */
body {
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==== Komponen Kustom ==== */
.card {
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    transition: box-shadow 0.3s ease-in-out, transform 0.3s ease-in-out;
}
.card:hover {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    transform: translateY(-2px);
}

/* ==== Animasi ==== */
@keyframes breathing-glow {
    0% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.3), inset 0 2px 4px rgba(0,0,0,0.02); }
    50% { box-shadow: 0 0 20px 3px rgba(20, 184, 166, 0.5), inset 0 2px 4px rgba(0,0,0,0.02); }
    100% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.3), inset 0 2px 4px rgba(0,0,0,0.02); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-15px); }
}
.tab-content-pane.is-active {
    animation: fadeIn 0.4s ease-out forwards;
}
.tab-content-pane.is-exiting {
    animation: fadeOut 0.3s ease-in forwards;
}

@keyframes pan-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.animated-title {
    background-image: linear-gradient(to right, var(--accent-text), var(--accent), var(--accent-text));
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: pan-gradient 5s linear infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(-12deg); }
    50% { transform: scale(1.1) rotate(-10deg); }
}
.animated-wand-icon {
    animation: sparkle 3s ease-in-out infinite;
    transition: transform 0.3s ease;
}
.animated-wand-icon:hover {
    transform: scale(1.2) rotate(5deg) !important; 
}

/* ==== Loader ==== */
.loader-icon {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background-image: url('https://sulapfoto.com/sflogo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: none;
    animation: spin 1.2s linear infinite;
    opacity: 0.5;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes modern-spin {
    0% { 
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    50% { 
        transform: rotate(180deg) scale(0.9);
        opacity: 0.85;
    }
    100% { 
        transform: rotate(360deg) scale(1);
        opacity: 1;
    }
}

/* ==== Input & Tombol Kustom ==== */
.file-input-label {
    cursor: pointer;
    border: 2px dashed var(--border-medium);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s, background-color 0.3s;
    height: 100%;
    color: var(--text-medium);
    background-color: transparent; 
}

.file-input-label:hover {
    border-color: var(--accent);
    background-color: var(--accent-light-bg);
}

.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center; z-index: 50;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.modal-backdrop.visible { opacity: 1; pointer-events: auto; }
.modal-content {
    background-color: var(--bg-dark); border: 1px solid var(--sidebar-border);
    padding: 2rem; border-radius: 0.75rem; width: 90%; max-width: 500px;
    transform: scale(0.95); transition: transform 0.3s ease;
    max-height: 90vh; overflow-y: auto; color: #e2e8f0;
}
.modal-backdrop.visible .modal-content { transform: scale(1); }

.sidebar-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.6rem 1.25rem; 
    font-weight: 500; 
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
    position: relative;
    color: #94a3b8; 
    border-left: 3px solid transparent; 
    cursor: pointer;
}

.sidebar-btn.active,
.sidebar-btn:not(.active):hover {
    background-image: linear-gradient(to right, rgba(20, 184, 166, 0.15), transparent); 
    color: #f8fafc;
    font-weight: 600;
    border-left-color: var(--accent);
}


.upload-box { border: 2px dashed var(--border-medium); transition: all 0.3s ease; }
.upload-box.dragging { border-color: var(--accent); background-color: var(--accent-light-bg); }
.upload-box img { max-height: 100%; max-width: 100%; object-fit: contain; }

textarea, input[type="text"], select {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    border: 1px solid var(--border-medium);
    color: var(--text-dark);
}
textarea:focus, input[type="text"]:focus, select:focus {
    --tw-ring-color: var(--accent); border-color: var(--accent);
}

/* ==== Scrollbar ==== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

#ef-draw-canvas {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="white" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08"/><path d="M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 0 0-3-3.02z"/></svg>') 12 12, crosshair;
    touch-action: none;
}

/* ==== Tombol Pilihan (Ratio, Style, dll.) ==== */
.option-btn, .checkbox-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-medium);
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}
.option-btn.selected, .checkbox-btn.selected {
    background-color: var(--accent-light-bg);
    border-color: var(--accent);
    color: var(--accent-text);
    font-weight: 600;
}
.validation-status {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    height: 1rem;
}
.result-action-btn {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    color: var(--text-dark);
    padding: 0.5rem;
    border-radius: 9999px;
    transition: background-color 0.2s;
}
.result-action-btn:hover {
    background-color: white;
}
.result-action-btn.download-btn {
    background-color: var(--accent);
    color: white;
}
.result-action-btn.download-btn:hover {
    background-color: var(--accent-hover);
}

.magic-tooltip {
    position: absolute;
    bottom: 100%;
    right: 2px;
    margin-bottom: 0.5rem;
    background-image: linear-gradient(to top right, #1e293b, #0f172a);
    border: 1px solid var(--sidebar-border);
    color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    width: 240px;
    font-weight: 500;
    font-size: 0.8rem;
    line-height: 1.4;
    border-radius: 0.5rem;
    transform: translateY(10px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
}
.magic-tooltip.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.magic-tooltip .arrow {
    position: absolute;
    bottom: -5px;
    right: 20px;
    width: 10px;
    height: 10px;
    background-color: #1e293b;
    border-bottom: 1px solid var(--sidebar-border);
    border-right: 1px solid var(--sidebar-border);
    transform: rotate(45deg);
}

/* ==== Toggle Switch ==== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--accent);
}
input:checked + .slider:before {
    transform: translateX(22px);
}

/* ==== Carousel ==== */
.carousel-container {
    position: relative;
    overflow: hidden; 
    border-radius: 0.75rem;
}
.carousel-slides {
    display: flex;
    transition: transform 0.5s ease-in-out;
}
.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    position: relative;
}
.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 10;
}
.carousel-nav:hover { background-color: rgba(0, 0, 0, 0.7); }
.carousel-nav.prev { left: 8px; }
.carousel-nav.next { right: 8px; }
.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}
.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    transition: background-color 0.3s;
}
.carousel-dot.active {
    background-color: white;
}

.crsl-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-dark);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform-origin: bottom center;
    scale: 0.9;
}
.crsl-tooltip.visible {
    opacity: 1;
    pointer-events: auto;
    scale: 1;
}
.crsl-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--bg-dark) transparent transparent transparent;
}

/* ==== Chat Assistant ==== */
.chat-bubble {
    position: relative;
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem; 
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    animation: pop-in 0.3s ease-out;
}
@keyframes pop-in {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.chat-bubble::after {
    content: "";
    position: absolute;
    top: 10px;
    border-width: 8px;
    border-style: solid;
}
.chat-bubble.sufo {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    border-top-left-radius: 0;
    align-self: flex-start;
    margin-left: 10px;
}
.chat-bubble.sufo::after {
    left: -16px; 
    border-color: transparent white transparent transparent;
}
.chat-bubble.user {
    background-color: var(--accent);
    color: white;
    border-top-right-radius: 0;
    align-self: flex-end;
    margin-right: 10px;
}
.chat-bubble.user::after {
    right: -16px; 
    border-color: transparent transparent transparent var(--accent);
}
#chat-input {
    background-color: white;
    border: 1px solid var(--border-medium);
}
#chat-input:focus {
    --tw-ring-color: var(--accent);
    border-color: var(--accent);
}
.chat-upload-label {
    cursor: pointer;
    border: 2px dashed var(--accent-text);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    gap: 0.5rem;
    border-radius: 0.5rem;
    background-color: rgba(255, 255, 255, 0.5);
    color: var(--accent-text);
}
.chat-upload-label:hover {
    background-color: white;
    border-color: var(--accent);
}
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--text-medium);
    border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: -0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: -0.4s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* ==== Sidebar Scrollbar ==== */
aside nav::-webkit-scrollbar {
    width: 6px;
}
aside nav::-webkit-scrollbar-track {
    background: transparent;
}
aside nav::-webkit-scrollbar-thumb {
    background: var(--sidebar-border);
    border-radius: 10px;
}
aside nav::-webkit-scrollbar-thumb:hover {
    background: #475569; 
}

/* ==== Penyesuaian Desktop ==== */
@media (min-width: 1024px) {
    .desktop-carousel-frame {
        max-width: 400px;
        margin: 1rem auto;
        padding: 0.75rem;
        background-color: white;
        border-radius: 1.5rem;
        border: 1px solid var(--border-medium);
        box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
        overflow: hidden;
    }
    .desktop-carousel-frame .carousel-container {
        border-radius: 1rem; 
    }
}

/* ==== Tombol Tab Konten Utama ==== */
.vto-tab-btn, .mg-tab-btn, .sf-tab-btn, .ef-tab-btn, .dr-tab-btn {
    padding: 0.625rem 1rem; 
    border-radius: 0.75rem; 
    font-weight: 600;
    font-size: 0.875rem;
    color: #475569; 
    transition: all 0.25s ease-in-out;
    border: none;
    background-color: transparent;
    cursor: pointer;
}

.vto-tab-btn:hover:not(.active), 
.mg-tab-btn:hover:not(.active),
.sf-tab-btn:hover:not(.active),
.ef-tab-btn:hover:not(.active),
.dr-tab-btn:hover:not(.active) {
    background-color: #e2e8f0; 
}

.beranda-tab-btn {
    padding: 0.625rem 1rem; 
    border-radius: 0.75rem; 
    font-weight: 600;
    font-size: 0.875rem;
    color: #475569; 
    transition: all 0.25s ease-in-out;
    border: none;
    background-color: transparent;
    cursor: pointer;
}

.beranda-tab-btn:hover:not(.active) {
    background-color: #e2e8f0; 
}

.beranda-tab-btn.active {
    background-color: #ffffff;
    color: var(--accent-text); 
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.vto-tab-btn.active,
.mg-tab-btn.active,
.sf-tab-btn.active,
.ef-tab-btn.active,
.dr-tab-btn.active {
    background-color: #ffffff;
    color: var(--accent-text); 
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* ==== Musik Equalizer ==== */
@keyframes equalize {
    0% { transform: scaleY(0.1); }
    25% { transform: scaleY(1.0); }
    50% { transform: scaleY(0.3); }
    75% { transform: scaleY(0.75); }
    100% { transform: scaleY(0.1); }
}

#equalizer-icon .eq-bar {
    transform-origin: bottom;
    transition: transform 0.2s ease-out;
    transform: scaleY(0.1); 
}

#equalizer-icon.playing .eq-bar {
    animation: equalize 1.2s infinite ease-in-out;
}
#equalizer-icon.playing .eq-bar:nth-child(2) {
    animation-delay: -0.2s;
}
#equalizer-icon.playing .eq-bar:nth-child(3) {
    animation-delay: -0.4s;
}

/* ==== Chat Group ==== */
.group-chat-bubble {
    position: relative;
    max-width: 80%;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
    animation: pop-in 0.3s ease-out;
}
.group-chat-bubble.other {
    background-color: #f1f5f9;
    color: var(--text-dark);
    border-bottom-left-radius: 0.25rem;
    align-self: flex-start;
}
.group-chat-bubble.me {
    background-color: var(--accent);
    color: white;
    border-bottom-right-radius: 0.25rem;
    align-self: flex-end;
}
.group-chat-bubble .username {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
    display: block;
}
.group-chat-bubble.other .username { color: var(--accent-text); }
.group-chat-bubble.me .username { color: #f0fdfa; }

/* ==== Slider Kustom ==== */
.custom-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    position: relative;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background-color: var(--accent);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    margin-top: -6px; 
}

.custom-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background-color: var(--accent);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    cursor: pointer;
}

.custom-slider::-moz-range-track {
    background-color: var(--border-color);
    height: 8px;
    border-radius: 8px;
}

#sidebar-tooltip {
    opacity: 0;
    transform: translateY(-50%) translateX(-15px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
#sidebar-tooltip.visible {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
#sidebar-tooltip .arrow {
    position: absolute;
    top: 50%;
    left: -5px;
    width: 10px;
    height: 10px;
    background-color: #0f172a;
    transform: translateY(-50%) rotate(45deg);
}

/* ==== Perluas Foto (Outpainting) ==== */
#ep-canvas-container {
    touch-action: none;
}
.ep-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background-color: white;
    border: 2px solid var(--accent);
    border-radius: 50%;
    z-index: 10;
    pointer-events: auto; 
}
#ep-resize-frame {
     pointer-events: auto; 
     cursor: move; 
}
#ep-handle-nw { top: -7px; left: -7px; cursor: nwse-resize; }
#ep-handle-n { top: -7px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
#ep-handle-ne { top: -7px; right: -7px; cursor: nesw-resize; }
#ep-handle-w { top: 50%; left: -7px; transform: translateY(-50%); cursor: ew-resize; }
#ep-handle-e { top: 50%; right: -7px; transform: translateY(-50%); cursor: ew-resize; }
#ep-handle-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
#ep-handle-s { bottom: -7px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
#ep-handle-se { bottom: -7px; right: -7px; cursor: nwse-resize; }

.ep-zoom-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    background-image: linear-gradient(to right, var(--accent), var(--accent));
    background-size: 0% 100%;
    background-repeat: no-repeat;
}
.ep-zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background-color: var(--accent);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    cursor: pointer;
}
.ep-zoom-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background-color: var(--accent);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    cursor: pointer;
}

#ep-workspace {
    background-color: #f8fafc; 
    background-image: 
      linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%),
      linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

/* Chrome/Safari bug fix for dashed border animation */
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}