/**
 * EA Generator v3 - Shared Stylesheet
 */

:root {
    --font-family: 'Inter', 'Microsoft YaHei UI', system-ui, sans-serif;
    --font-family-mono: 'Cascadia Code', 'Fira Code', monospace;

    --color-primary: #6366F1;
    --color-primary-hover: #4F46E5;
    --color-primary-light: rgba(99, 102, 241, 0.1);

    --color-success: #22C55E;
    --color-danger: #EF4444;
    --color-warning: #F59E0B;
    --color-info: #3B82F6;

    --color-bg: #F8FAFC;
    --color-card: #FFFFFF;
    --color-border: #E2E8F0;

    --color-text: #1E293B;
    --color-text-sub: #64748B;
    --color-text-muted: #94A3B8;

    --radius-xl: 20px;
    --radius-lg: 12px;
    --radius-md: 10px;
    --radius-sm: 8px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
    max-width: 360px;
}

.toast-success { background: #16A34A; }
.toast-error { background: #DC2626; }
.toast-info { background: #2563EB; }
.toast-warning { background: #D97706; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #6366F1, #4F46E5);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #4F46E5, #4338CA);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: #F1F5F9;
    color: #475569;
    border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: #E2E8F0;
}

.btn-danger {
    background: #FEE2E2;
    color: #DC2626;
}

.btn-danger:hover:not(:disabled) {
    background: #FECACA;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-sub);
}

.btn-ghost:hover:not(:disabled) {
    background: #F1F5F9;
    color: var(--color-text);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

/* Cards */
.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text);
}

.card-body {
    padding: 20px;
}

/* Form Elements */
.input, .textarea, select.input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-family);
    background: #fff;
    color: var(--color-text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus, .textarea:focus, select.input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.textarea {
    resize: vertical;
    min-height: 80px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
}

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

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success { background: #DCFCE7; color: #166534; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }

/* Status Dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot-online { background: var(--color-success); }
.status-dot-offline { background: var(--color-danger); }

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* Table */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-sub);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #F8FAFC;
    border-bottom: 1px solid var(--color-border);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #F1F5F9;
    font-size: 14px;
}

.data-table tr:hover td {
    background: #F8FAFC;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
}

.pagination button {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--color-text);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination button:hover {
    background: #F1F5F9;
}

.pagination button.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .card-body { padding: 16px; }
    .data-table th, .data-table td { padding: 8px 12px; }
}
