/* 
 * KEICHA UI Dialog System
 * Colors: Brand Green (#6ea44c), White, Gray Scale
 */

:root {
    --kui-green: #6ea44c;
    --kui-green-dark: #5d8d41;
    --kui-bg: rgba(255, 255, 255, 0.95);
    --kui-text: #1e293b;
    --kui-gray: #64748b;
    --kui-gray-light: #f1f5f9;
    /* Corner Radius System */
    --kui-radius-sm: 8px;
    --kui-radius-md: 16px;
    --kui-radius-lg: 24px;
}

@keyframes kui-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes kui-scale-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes kui-toast-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.kui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: kui-fade-in 0.2s ease-out;
}

.kui-dialog {
    background: var(--kui-bg);
    border-radius: var(--kui-radius-lg);
    width: 100%;
    max-width: 400px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: kui-scale-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

.kui-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--kui-gray-light);
    color: var(--kui-green);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.kui-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--kui-text);
    margin-bottom: 8px;
}

.kui-message {
    font-size: 0.9375rem;
    color: var(--kui-gray);
    line-height: 1.6;
    margin-bottom: 24px;
    white-space: pre-wrap;
}

.kui-actions {
    display: flex;
    gap: 12px;
}

.kui-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--kui-radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    outline: none;
}

.kui-btn-primary {
    background: var(--kui-green);
    color: white;
}

.kui-btn-primary:hover {
    background: var(--kui-green-dark);
    transform: translateY(-1px);
}

.kui-btn-secondary {
    background: var(--kui-gray-light);
    color: var(--kui-gray);
}

.kui-btn-secondary:hover {
    background: #e2e8f0;
    color: var(--kui-text);
}

/* Toast Style */
.kui-toast-container {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    pointer-events: none;
}

.kui-toast {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(8px);
    color: white;
    padding: 10px 20px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: kui-toast-in 0.3s ease-out;
    margin-bottom: 10px;
}

/* Custom Select (Dropdown) */
.kui-select-container {
    position: relative;
    width: 100%;
}

.kui-select-display {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    /* Radius-MD */
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    transition: all 0.2s;
    user-select: none;
}

.kui-select-display:hover {
    border-color: #cbd5e1;
}

.kui-select-container.open .kui-select-display {
    border-color: var(--kui-green);
    box-shadow: 0 0 0 3px rgba(110, 164, 76, 0.1);
}

.kui-select-display::after {
    content: 'expand_more';
    font-family: 'Material Symbols Rounded';
    font-size: 20px;
    color: #64748b;
    transition: transform 0.2s;
}

.kui-select-container.open .kui-select-display::after {
    transform: rotate(180deg);
}

.kui-select-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
    z-index: 1000;
    max-height: 240px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.kui-select-container.open .kui-select-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.kui-select-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.9375rem;
    color: #334155;
}

.kui-select-option:hover {
    background: #f8fafc;
}

.kui-select-option.selected {
    background: rgba(110, 164, 76, 0.1);
    color: var(--kui-green);
    font-weight: 600;
}

/* Native select hidden but accessible */
.kui-select-native {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Tooltip (Validation Bubble) */
.kui-tooltip {
    position: absolute;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10000;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    border: 1px solid #f1f5f9;
    animation: kui-scale-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.kui-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 20px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid white;
}

.kui-tooltip-icon {
    width: 20px;
    height: 20px;
    background: var(--kui-green);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}