/* Estilos Globais Inspirados no FluidUI */
:root {
    --background-color: #f0f2f5;
    --card-background: rgba(255, 255, 255, 0.6);
    --text-color: #1c1e21;
    --primary-color: #cd0000;
    --primary-hover-color: #991a1a;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --glass-blur: 15px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 15% 50%, rgba(205, 0, 0, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(205, 0, 0, 0.05) 0%, transparent 40%);
    z-index: -1;
    animation: floating-glow 15s ease-in-out infinite;
}

@keyframes floating-glow {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.05); }
}

/* --- Tela de Carregamento --- */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f0f2f5 0%, #e8eaed 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-container {
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(205, 0, 0, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: 1px;
    background: linear-gradient(90deg, var(--primary-color), #f06060);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Tela de Login --- */
#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: var(--card-background);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px var(--shadow-color);
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

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

.login-container h2 {
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.login-container p {
    margin-bottom: 30px;
    color: #666;
}

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

.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(205, 0, 0, 0.2);
}

.btn {
    background: linear-gradient(to right, #f06060, var(--primary-color));
    color: #fff;
    padding: 12px 25px;
    border-radius: 30px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    box-shadow: 0 4px 15px rgba(205, 0, 0, 0.25);
    width: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(205, 0, 0, 0.35);
}

#error-message {
    color: var(--primary-color);
    margin-top: 15px;
    font-size: 0.9rem;
    display: none;
}

.register-link {
    margin-top: 20px;
    font-size: 0.9rem;
}
.register-link a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

/* --- Workspace --- */
#workspace-screen {
    display: none;
    height: 100vh;
    flex-direction: column;
}

.header {
    background: var(--card-background);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

#language-selector {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.logout-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-color);
    transition: color 0.3s ease;
}
.logout-btn:hover {
    color: var(--primary-color);
}

.main-container {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

.sidebar-header {
    margin-bottom: 10px;
}

.sidebar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.sidebar-btn {
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 10px;
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-weight: 500;
    transition: all 0.2s ease;
}
.sidebar-btn:hover {
    background-color: rgba(255, 255, 255, 1);
    border-color: var(--primary-color);
}
.sidebar-btn i {
    margin-right: 10px;
    color: var(--primary-color);
}

#folders-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
}
#folders-list li {
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#folders-list li:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
#folders-list li.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
}
.folder-actions button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    margin-left: 8px;
}
    .folder-actions button:hover {
    opacity: 1;
}

.main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
}

.main-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.main-content-header h2 {
    font-size: 1.8rem;
}
.add-prompt-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(205, 0, 0, 0.25);
}
.add-prompt-btn:hover {
        transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(205, 0, 0, 0.35);
}

#prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.prompt-card {
    background: var(--card-background);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 16px var(--shadow-color);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
}

.prompt-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 40px var(--shadow-color);
}

.prompt-card-header {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    margin-bottom: 15px;
}

.prompt-card-img {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.prompt-card-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
}
.prompt-card-desc {
    font-size: 0.9rem;
    color: #555;
    flex-grow: 1;
}

.prompt-card-tags {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
}

.prompt-card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.7);
    padding: 5px;
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.prompt-card:hover .prompt-card-actions {
    opacity: 1;
}
.prompt-card-actions button {
    background: none;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}
.prompt-card-actions button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

#empty-state {
    text-align: center;
    padding: 50px;
    color: #888;
}
#empty-state i {
    font-size: 3rem;
    margin-bottom: 20px;
}
#empty-state h3 {
    font-size: 1.5rem;
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.modal-overlay.active .modal {
    transform: scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}
.modal-header h2 {
    font-size: 1.5rem;
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #888;
}

.modal-body {
    overflow-y: auto;
    padding-right: 10px; /* For scrollbar */
}

.modal-body textarea {
    min-height: 120px;
    resize: vertical;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
    flex-shrink: 0;
}

.modal-btn {
        padding: 10px 20px;
        border-radius: 25px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.3s ease;
        border: none;
}
.modal-btn.primary {
    background-color: var(--primary-color);
    color: #fff;
}
.modal-btn.secondary {
    background-color: #e4e6eb;
    color: var(--text-color);
}
.modal-btn.secondary:hover {
    background-color: #d8dbdf;
}
.modal-btn.danger {
    background-color: #e74c3c;
    color: white;
}

#use-prompt-modal .variable-input-group {
    margin-bottom: 15px;
}
#use-prompt-modal label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}
#use-prompt-modal-banner {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 20px;
}
#copy-prompt-btn {
    width: 100%;
    font-size: 1.1rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    animation: toast-in 0.5s forwards;
}

@keyframes toast-in {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Responsividade */
@media (max-width: 768px) {
    .header {
        padding: 15px;
    }
    .main-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.3);
        height: auto;
        max-height: 40vh;
    }
    .main-content {
        padding: 20px;
    }
    .add-prompt-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        font-size: 1.5rem;
        padding: 0;
        z-index: 100;
    }
    .add-prompt-btn span { display: none; }
}