* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
    font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
    padding: 15px;
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(148, 119, 232, 0.15) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    animation: float 8s ease-in-out infinite;
}

body::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 139, 180, 0.12) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
    animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

.container {
    max-width: 1600px;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    text-align: center;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 20px;
    align-items: start;
    text-align: left;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

@media (max-width: 1024px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

#login-form {
    display: inline-block;
    animation: fadeIn 0.5s ease-out;
    max-width: 500px;
    margin: 0 auto;
}

#login-form .card {
    padding: 40px;
}

#login-form .card-title {
    font-size: 1.5rem;
    margin-bottom: 25px;
}

#login-form .form-control {
    padding: 14px 18px;
    font-size: 1rem;
}

#login-form .btn-primary {
    padding: 14px 28px;
    font-size: 1rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

.card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(148, 119, 232, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin-bottom: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideIn 0.6s ease-out;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(148, 119, 232, 0.2);
    border-color: rgba(148, 119, 232, 0.3);
}

.card-title {
    color: #c49cf3;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

.card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.form-group {
    text-align: left;
    margin-bottom: 15px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group label i {
    color: #9477e8;
    font-size: 0.9rem;
}

.form-control {
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    /* padding: 10px 14px; */
    color: #fff;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-control:focus {
    background-color: rgba(255, 255, 255, 0.18);
    border-color: #9477e8;
    box-shadow: 0 0 0 4px rgba(148, 119, 232, 0.15);
    outline: none;
    color: #fff;
}

.form-control:disabled {
    background-color: rgba(255, 255, 255, 0.05);
    cursor: not-allowed;
    opacity: 0.6;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

select.form-control option {
    background: #1a1a2e;
    color: #fff;
    padding: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #9477e8 0%, #7d67be 100%);
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    width: 100%;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(148, 119, 232, 0.4);
    flex-shrink: 0;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(148, 119, 232, 0.5);
    background: linear-gradient(135deg, #a68af5 0%, #8e76cc 100%);
}


.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.alert {
    border-radius: 10px;
    border: none;
    padding: 12px 16px;
    font-size: 0.85rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: rgba(72, 187, 120, 0.2);
    border-left: 4px solid #48bb78;
    color: #9ae6b4;
}

.alert-danger {
    background: rgba(245, 101, 101, 0.2);
    border-left: 4px solid #f56565;
    color: #fc8181;
}

#workspace-area {
    display: none;
}

#client-selection {
    max-width: 100%;
}

#client-selection,
#prompt-update {
    height: 100%;
    overflow: hidden;
}

#prompt-update.visible {
    animation: slideIn 0.5s ease-out;
}

#prompt-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#prompt-editor form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

#prompt-editor .form-group:has(textarea) {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 0;
    flex-shrink: 0;
    animation: fadeIn 0.8s ease-out;
}

.logo {
    flex: 1;
    text-align: center;
}

.logo h1 {
    font-size: 2rem;
    background: linear-gradient(135deg, #9477e8 0%, #ff8bb4 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
    letter-spacing: -2px;
    margin-bottom: 0;
    filter: drop-shadow(0 0 20px rgba(148, 119, 232, 0.4));
    transition: all 0.3s ease;
}

.logo h1:hover {
    filter: drop-shadow(0 0 30px rgba(148, 119, 232, 0.6));
}

.logo p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin: 0;
}

#workspace-area {
    display: none;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
}

#workspace-area.active {
    display: flex;
}

#logout-btn {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 8px 16px;
    color: #fff;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-size: 0.85rem;
    flex-shrink: 0;
}

#logout-btn:hover {
    background: rgba(245, 101, 101, 0.2);
    border-color: #f56565;
    color: #fc8181;
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
}

#logout-btn i {
    margin-right: 6px;
}

#library-suggestions {
    max-height: calc(100vh - 500px);
    min-height: 150px;
    overflow-y: auto;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 1;
}

#library-suggestions::-webkit-scrollbar {
    width: 6px;
}

#library-suggestions::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

#library-suggestions::-webkit-scrollbar-thumb {
    background: rgba(148, 119, 232, 0.5);
    border-radius: 10px;
}

#library-suggestions::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 119, 232, 0.7);
}

.list-group-item {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    padding: 12px 16px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.9rem;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background: rgba(148, 119, 232, 0.15);
    color: #fff;
}

.list-group-item:active {
    background: rgba(148, 119, 232, 0.25);
}

.list-group-item i {
    margin-right: 10px;
    color: #9477e8;
}

.btn-group-toggle label {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    padding: 10px 18px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-group-toggle label:first-child {
    border-radius: 12px 0 0 12px;
}

.btn-group-toggle label:last-child {
    border-radius: 0 12px 12px 0;
}

.btn-group-toggle label:hover {
    background: rgba(148, 119, 232, 0.15);
    border-color: rgba(148, 119, 232, 0.3);
}

.btn-group-toggle label.active {
    background: linear-gradient(135deg, #9477e8 0%, #7d67be 100%);
    border-color: #9477e8;
    color: #fff;
    box-shadow: 0 2px 8px rgba(148, 119, 232, 0.4);
}

.btn-group-toggle input[type="radio"] {
    display: none;
}

.form-group-separator {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

textarea.form-control {
    resize: none;
    height: calc(100vh - 440px);
    min-height: 250px;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    flex: 1;
}

textarea.form-control::-webkit-scrollbar {
    width: 8px;
}

textarea.form-control::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

textarea.form-control::-webkit-scrollbar-thumb {
    background: rgba(148, 119, 232, 0.4);
    border-radius: 10px;
}

textarea.form-control::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 119, 232, 0.6);
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#namePrompt {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    display: block;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(148, 119, 232, 0.1);
    border-radius: 8px;
    border-left: 3px solid #9477e8;
}

#namePrompt:empty {
    display: none;
}

#update-message {
    flex-shrink: 0;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .logo h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 15px;
    }

    #logout-btn {
        right: 10px;
        top: 10px;
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    body {
        padding: 10px;
    }

    .workspace-grid {
        gap: 15px;
    }
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.3;
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

.prompt-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

.prompt-empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.prompt-empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.prompt-empty-state p {
    font-size: 0.95rem;
    opacity: 0.7;
}

