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

:root {
    --primary: #00d084;
    --secondary: #00bcd4;
    --dark: #0a0e27;
    --darker: #050810;
    --card: #141829;
    --border: #2a3050;
    --text: #ffffff;
    --text-dim: #b0b5c1;
    --text-gray: #6b7280;
    --error: #ff4757;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--dark) 0%, var(--darker) 100%);
    color: var(--text);
}

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: var(--card);
    border: 2px solid var(--secondary);
    color: var(--secondary);
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    word-break: break-word;
    transition: all 0.3s ease;
    transform: translateX(450px);
    opacity: 0;
    pointer-events: all;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-height: 50px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(450px);
    opacity: 0;
}

.toast.success {
    border-color: var(--primary);
    color: var(--primary);
    border-left: 5px solid var(--primary);
}

.toast.error {
    border-color: var(--error);
    color: var(--error);
    border-left: 5px solid var(--error);
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 0.7;
}

.sidebar {
    position: fixed;
    right: -350px;
    top: 0;
    width: 350px;
    height: 100vh;
    background: var(--card);
    border-left: 2px solid var(--border);
    transition: right 0.3s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid var(--border);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.sidebar-close:hover {
    color: var(--primary);
}

.sidebar-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #1a2535 0%, #0f1828 100%);
    border: 2px solid var(--secondary);
    color: var(--secondary);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
}

.sidebar-item:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateX(-4px);
}

.sidebar-item span {
    font-size: 18px;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 8px 0;
}

.workflow-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.workflow-item {
    padding: 12px;
    background: rgba(0, 208, 132, 0.1);
    border: 1px solid rgba(0, 208, 132, 0.3);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 998;
}

.sidebar-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

.main {
    width: 100%;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px 40px;
    background: var(--card);
    border-bottom: 2px solid var(--border);
}

.header-left h1 {
    font-size: 32px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.header-left p {
    font-size: 12px;
    color: var(--text-dim);
}

.menu-btn {
    background: linear-gradient(135deg, #1a3a3a 0%, #0a2a2a 100%);
    border: 2px solid var(--secondary);
    color: var(--secondary);
    width: 50px;
    height: 50px;
    border-radius: 12px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.1);
}

.container {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.btn-workflow {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px 16px;
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1829 100%);
    border: 2px solid var(--secondary);
    color: var(--text);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    border-radius: 16px;
    transition: all 0.3s;
    min-height: 180px;
    position: relative;
    overflow: hidden;
}

.btn-workflow:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, #0a2a1a 0%, #051809 100%);
    transform: translateY(-8px);
}

.btn-workflow.success {
    border-color: var(--primary);
}

.btn-workflow.error {
    border-color: var(--error);
}

.btn-workflow .icon {
    font-size: 56px;
}

.btn-workflow .icon-img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
}

.btn-workflow .icon-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-workflow .name {
    font-size: 10px;
    text-align: center;
    text-transform: uppercase;
    color: var(--text-dim);
}

.btn-workflow .delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--error);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-workflow:hover .delete {
    opacity: 1;
}

.btn-workflow .edit {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--secondary);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-workflow:hover .edit {
    opacity: 1;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.open {
    display: flex;
}

.modal-card {
    background: var(--card);
    border-radius: 20px;
    border: 2px solid var(--border);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 28px;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 2px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

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

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: #1a1f3a;
    color: var(--text);
    font-size: 13px;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.icon-preview-box {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.icon-preview {
    width: 100px;
    height: 100px;
    background: var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    border: 2px solid var(--secondary);
    overflow: hidden;
}

.icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.color-picker {
    display: flex;
    gap: 12px;
    align-items: center;
}

.color-picker input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--border);
}

.btn-primary,
.btn-secondary {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #00a86b 100%);
    color: #000;
    width: 100%;
    margin-bottom: 12px;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--border);
    color: var(--text-dim);
    flex: 1;
}

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

.btn-danger {
    background: linear-gradient(135deg, var(--error) 0%, #ff3838 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    flex: 1;
}

.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: background 0.3s;
}

.confirm-overlay.show {
    background: rgba(0, 0, 0, 0.7);
}

.confirm-dialog {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    max-width: 400px;
    width: 90%;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.3s;
}

.confirm-overlay.show .confirm-dialog {
    transform: scale(1);
    opacity: 1;
}

.confirm-dialog p {
    font-size: 15px;
    color: var(--text);
    margin-bottom: 20px;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
}

@media (max-width: 768px) {
    .header {
        padding: 20px;
    }

    .container {
        padding: 20px;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    .sidebar {
        width: 280px;
    }

    #toast-container {
        bottom: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
    }
}

.toast.loading {
    border-color: var(--secondary);
    color: var(--secondary);
    border-left: 5px solid var(--secondary);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

    background: var(--primary);
    transform: scale(1.1);
}

    background: var(--primary);
    transform: scale(1.1);
}

.help-btn-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #00a86b 100%);
    border: none;
    color: white;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 208, 132, 0.3);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.help-btn-fab:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(0, 208, 132, 0.5);
}

.help-btn-fab:active {
    transform: scale(0.95);
}

.help-btn-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #00a86b 100%);
    border: none;
    color: white;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 208, 132, 0.3);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.help-btn-fab:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(0, 208, 132, 0.5);
}

.help-btn-fab:active {
    transform: scale(0.95);
}

.help-btn-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #00a86b 100%);
    border: none;
    color: white;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 208, 132, 0.3);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.help-btn-fab:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(0, 208, 132, 0.5);
}

.help-btn-fab:active {
    transform: scale(0.95);
}
