* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --card-bg: rgba(30, 41, 59, 0.6);
    --accent-cyan: #06b6d4;
    --accent-blue: #3b82f6;
    --discord-bg: #36393f;
    --discord-embed-bg: #2f3136;
    --discord-text: #dcddde;
    --discord-text-muted: #72767d;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Open Sans', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.5s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    padding: 3rem 0 2rem 0;
    animation: fadeInDown 0.8s ease;
}

h1 {
    color: var(--text-primary);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 20px rgba(6, 182, 212, 0.3);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.action-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(6, 182, 212, 0.2);
    animation: fadeInUp 0.8s ease;
}

.input-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.webhook-input {
    flex: 1;
    min-width: 250px;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid rgba(6, 182, 212, 0.3);
    border-radius: 12px;
    color: var(--accent-cyan);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
}

.webhook-input::placeholder {
    color: rgba(6, 182, 212, 0.4);
}

.webhook-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
    transform: translateY(-2px);
}

#sendBtn {
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
}

#sendBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(6, 182, 212, 0.5);
}

#sendBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#sendBtn.loading span {
    visibility: hidden;
}

#sendBtn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

.embed-editor-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeInUp 0.8s ease 0.1s both;
}

.bot-settings-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(6, 182, 212, 0.2);
    display: flex;
    gap: 1.5rem;
}

.edit-section {
    flex: 1;
}

.section-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.editable-field {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.editable-field:hover {
    border-color: var(--accent-cyan);
    background: rgba(15, 23, 42, 0.7);
    transform: translateY(-1px);
}

.editable-field span:first-child {
    color: var(--text-primary);
    flex: 1;
}

.edit-icon {
    font-size: 1rem;
    opacity: 0.6;
}

.url-display {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.discord-preview-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.discord-message {
    background: var(--discord-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.user {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.user-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
}

.username-display {
    color: var(--discord-text);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.message-edit-wrapper {
    margin-top: 0.5rem;
}

.message-display {
    color: var(--discord-text);
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.edit-btn-inline {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--accent-cyan);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-btn-inline:hover {
    background: rgba(6, 182, 212, 0.25);
    border-color: var(--accent-cyan);
}

.edit-icon-small {
    font-size: 0.85rem;
}

.embed-body {
    background-color: var(--discord-embed-bg);
    border-left: 4px solid #e8d44f;
    border-radius: 4px;
    padding: 1rem;
    margin-left: 3.5rem;
    position: relative;
}

.edit-section-embed {
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.section-label-embed {
    color: var(--discord-text-muted);
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.color-edit-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.color-edit-field:hover {
    background: rgba(6, 182, 212, 0.1);
}

.color-preview {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.color-edit-field span {
    color: var(--discord-text-muted);
    font-size: 0.9rem;
}

.embed-section {
    margin: 0.75rem 0;
}

.embed-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.author-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.author-name {
    color: var(--discord-text);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.embed-title-wrapper,
.embed-description-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.embed-title-display {
    color: var(--discord-text);
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
}

.embed-description-display {
    color: var(--discord-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    flex: 1;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.embed-description-display p {
    margin: 0;
    margin-bottom: 0.5em;
}

.embed-description-display p:last-child {
    margin-bottom: 0;
}

.embed-description-display strong {
    font-weight: 700;
    color: var(--discord-text);
}

.embed-description-display em {
    font-style: italic;
}

.embed-description-display code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.embed-description-display pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.embed-description-display pre code {
    background: none;
    padding: 0;
}

.embed-description-display a {
    color: #00b0f4;
    text-decoration: none;
}

.embed-description-display a:hover {
    text-decoration: underline;
}

.embed-description-display del {
    text-decoration: line-through;
}

.embed-description-display ul,
.embed-description-display ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.embed-description-display li {
    margin: 0.25em 0;
}

.embed-description-display blockquote {
    border-left: 4px solid rgba(255, 255, 255, 0.2);
    padding-left: 0.75rem;
    margin: 0.5em 0;
    color: var(--discord-text-muted);
}

.add-section-btn {
    background: rgba(6, 182, 212, 0.1);
    border: 1px dashed rgba(6, 182, 212, 0.3);
    color: var(--accent-cyan);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.add-section-btn:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--accent-cyan);
    border-style: solid;
}

.edit-btn-small {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--accent-cyan);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-btn-small:hover {
    background: rgba(6, 182, 212, 0.25);
}

.embed-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.embed-field {
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.embed-field:hover {
    background: rgba(0, 0, 0, 0.2);
}

.embed-field.inline {
    width: calc(33.333% - 0.5rem);
    flex-grow: 0;
    flex-shrink: 0;
}

.field-name-display {
    color: var(--discord-text);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.field-value-display {
    color: var(--discord-text-muted);
    font-size: 0.875rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.field-edit-icon {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 0.85rem;
}

.embed-field:hover .field-edit-icon {
    opacity: 0.6;
}

.images-edit {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.images-edit .add-section-btn {
    flex: 1;
}

.embed-thumbnail {
    position: absolute;
    top: 1rem;
    right: 1rem;
    max-width: 80px;
    max-height: 80px;
    border-radius: 4px;
    object-fit: cover;
}

.embed-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    margin-top: 0.5rem;
    object-fit: contain;
}

.embed-footer-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--discord-text-muted);
    font-size: 0.75rem;
}

.footer-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
    border-radius: 20px;
    padding: 0;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(6, 182, 212, 0.3);
    animation: modalSlideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(6, 182, 212, 0.2);
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.close-btn:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 1rem 0 0.5rem 0;
}

.modal-body label:first-child {
    margin-top: 0;
}

.modal-input,
.modal-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

.modal-input::placeholder,
.modal-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.modal-input:focus,
.modal-textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.modal-textarea {
    resize: vertical;
    min-height: 100px;
}

.checkbox-container {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem !important;
    cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-cyan);
}

.checkbox-container span {
    color: var(--text-primary);
    font-size: 0.95rem;
    text-transform: none;
    letter-spacing: normal;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid rgba(6, 182, 212, 0.2);
}

.btn-primary,
.btn-secondary,
.btn-delete {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(6, 182, 212, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.8);
    color: white;
    width: 100%;
    margin-top: 1.5rem;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 1);
    transform: translateY(-2px);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .bot-settings-card {
        flex-direction: column;
    }

    .embed-body {
        margin-left: 0;
    }

    .embed-thumbnail {
        position: static;
        display: block;
        margin: 0.5rem 0;
        max-width: 100%;
    }

    .embed-field.inline {
        width: 100%;
    }

    .images-edit {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}
