/* Shared Component Styles */

/* ===== BASE RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    background: var(--bg-dark);
    color: var(--text-color);
    line-height: var(--line-height-normal);
}

input:focus, 
select:focus, 
textarea:focus {
    outline: none;
    border-color: var(--primary-color) !important;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition-normal);
}

.btn-primary {
    background: var(--gradient-accent);
    color: #000;
    box-shadow: 0 4px 15px rgba(46, 160, 67, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

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

.btn-secondary {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-sm {
    padding: var(--spacing-xs) 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    border: 1px solid var(--border-color);
    background: #21262d;
    color: #c9d1d9;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-sm:hover {
    border-color: var(--text-muted);
}

.btn-sm.danger {
    border-color: var(--error-bg);
    color: var(--error-color);
}

.btn-sm.danger:hover {
    background: var(--error-bg);
}

.btn-xs {
    padding: 3px 8px;
    font-size: 10px;
}

.btn-9 {
    padding: 2px 6px;
    font-size: 9px;
}

.btn-full {
    width: 100%;
    padding: var(--spacing-sm) 0;
    font-size: var(--font-size-base);
    justify-content: center;
}

.btn-large {
    padding: 14px 28px;
    font-size: var(--font-size-lg);
}

.btn-12 {
    font-size: 12px;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge.running { background: var(--success-bg); color: var(--success-color); }
.badge.shutdown { background: var(--warning-bg); color: var(--warning-color); }
.badge.stopped { background: rgba(139,148,158,.15); color: #8b949e; }
.badge.unknown { background: #1f2937; color: var(--text-muted); }
.badge.nat { background: var(--success-bg); color: var(--success-color); }
.badge.bridge { background: #1f3a5f; color: #58a6ff; }
.badge.routed { background: #2d1b4e; color: #a371f7; }
.badge.isolated { background: var(--warning-bg); color: var(--warning-color); }
.badge.open { background: var(--warning-bg); color: var(--warning-color); }
.badge.available { background: var(--success-bg); color: var(--success-color); }
.badge.in-use { background: #1f3a5f; color: #58a6ff; }
.badge.ready { background: var(--success-bg); color: var(--success-color); }
.badge.creating { background: var(--warning-bg); color: var(--warning-color); }
.badge.failed { background: var(--error-bg); color: var(--error-color); }
.badge.degraded { background: var(--warning-bg); color: var(--warning-color); }

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.form-group input,
.form-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color var(--transition-normal);
}

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

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--bg-dark) inset !important;
    -webkit-text-fill-color: var(--text-color) !important;
}

.form-group input::placeholder {
    color: #484f58;
}

.form-label {
    display: block;
    font-size: var(--font-size-base);
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    color: #c9d1d9;
}

.form-label small {
    font-weight: 400;
    color: var(--text-muted);
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: var(--spacing-sm);
}

.error-message {
    margin-bottom: var(--spacing-lg);
    padding: 10px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    text-align: center;
    min-height: 20px;
}

/* ===== TABLES ===== */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-base);
}

thead th {
    background: #161b22;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #21262d;
}

tbody tr:last-child td {
    border-bottom: none;
}

.actions {
    display: flex;
    gap: 6px;
}

/* ===== LOADING & EMPTY STATES ===== */
.loading {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    color: var(--text-muted);
    font-size: var(--font-size-base);
    padding: 20px;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: spin var(--transition-slowest) linear infinite;
}

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

.empty-text {
    color: var(--text-muted);
    font-size: var(--font-size-base);
    text-align: center;
}

.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.empty-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-xl);
}

.bar-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-bottom: 14px;
}

.secret-type-card {
    border: 1px solid var(--border-color, #30363d);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-card, #161b22);
    transition: border-color .15s, background .15s;
}
.secret-type-card:hover {
    border-color: #58a6ff;
}
.secret-type-card.selected {
    border-color: #1f6feb;
    background: rgba(31, 111, 235, 0.08);
}

/* ===== SECTION HEADERS ===== */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    margin-bottom: 16px;
    color: #fff;
}

.section-header p {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: var(--z-modal-overlay);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active,
.modal-overlay.show {
    opacity: 1;
    visibility: visible;
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    position: relative;
    transform: translateY(-20px);
    transition: transform var(--transition-normal);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-overlay.active .modal,
.modal-overlay.show .modal {
    transform: translateY(0);
}

.modal-wide {
    max-width: 820px !important;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-normal);
    padding: 4px;
    line-height: 1;
}

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

.modal-header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: var(--font-size-3xl);
    color: #fff;
}

.modal-logo {
    height: 40px;
    width: auto;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    object-fit: contain;
}

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes highlightPulse {
    0% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(88, 166, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0); }
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.highlight-pulse {
    animation: highlightPulse 1s ease-in-out;
    border-radius: var(--radius-lg);
}

/* ===== UTILITIES ===== */
.separator {
    color: var(--border-color);
}

[data-theme="light"] .badge.creating { 
    background: var(--warning-lightest); 
    color: var(--warning-light); 
}

[data-theme="light"] .badge.degraded { 
    background: var(--warning-lightest); 
    color: var(--warning-light); 
}

[data-theme="light"] .badge.failed { 
    background: var(--error-light); 
    color: var(--error-light); 
}
