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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-info {
    background: #4299e1;
    color: white;
}

.btn-info:hover {
    background: #3182ce;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.success-message {
    background: #c6f6d5;
    color: #22543d;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.info-text {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 13px;
}

.info-text code {
    background: #f7fafc;
    padding: 2px 6px;
    border-radius: 3px;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

/* Dashboard */
.dashboard {
    min-height: 100vh;
    background: #f7fafc;
}

.navbar {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand h2 {
    color: #667eea;
    font-size: 20px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.badge {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge.admin {
    background: #f56565;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.dashboard-header h1 {
    color: #2d3748;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    color: #718096;
    font-size: 14px;
}

.domains-list {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Responsive table wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

table thead {
    background: #f7fafc;
}

table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
    white-space: nowrap;
}

table td {
    padding: 15px;
    border-top: 1px solid #e2e8f0;
    color: #2d3748;
    font-size: 14px;
}

table tbody tr:hover {
    background: #f7fafc;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-monitoring {
    background: #bee3f8;
    color: #2c5282;
}

.status-available {
    background: #c6f6d5;
    color: #22543d;
}

.status-registered {
    background: #9ae6b4;
    color: #22543d;
}

.status-failed {
    background: #fed7d7;
    color: #c53030;
}

.status-stopped {
    background: #e2e8f0;
    color: #4a5568;
}

.status-pending {
    background: #feebc8;
    color: #c05621;
}

.loading {
    text-align: center;
    color: #a0aec0;
    padding: 40px !important;
}

/* Owner badges */
.owner-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    background: #e2e8f0;
    color: #4a5568;
}

.owner-badge.mine {
    background: #bee3f8;
    color: #2c5282;
}

/* Unclaimed domain row highlight */
.unclaimed-domain {
    background: #fffff0 !important;
}

.unclaimed-domain:hover {
    background: #fefce8 !important;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.modal-content h2 {
    margin-bottom: 25px;
    color: #2d3748;
}

.close {
    color: #a0aec0;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #2d3748;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Action Buttons */
.action-buttons {
    gap: 5px;
}

.btn-icon {
    padding: 6px 12px;
    font-size: 12px;
}

/* Live Events */
.monitor-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.monitor-section h2 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 18px;
}

.live-events {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: 15px;
    background: #f7fafc;
}

.event-item {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 5px;
    border-left: 4px solid;
}

.event-item.info {
    background: #bee3f8;
    border-color: #3182ce;
}

.event-item.success {
    background: #c6f6d5;
    border-color: #38a169;
}

.event-item.error {
    background: #fed7d7;
    border-color: #e53e3e;
}

.event-item.warning {
    background: #feebc8;
    border-color: #dd6b20;
}

.event-time {
    font-size: 11px;
    color: #4a5568;
    margin-bottom: 5px;
}

.event-message {
    font-size: 14px;
    color: #2d3748;
    font-weight: 500;
}

.event-domain {
    font-size: 12px;
    color: #667eea;
    margin-top: 3px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: #48bb78;
}

.status-dot.offline {
    background: #f56565;
    animation: none;
}

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

#ws-status-text {
    font-size: 13px;
    color: #4a5568;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 12px;
    }

    table th,
    table td {
        padding: 10px;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #333;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.3s ease;
    z-index: 10000;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.toast.success {
    background: #48bb78;
}

.toast.error {
    background: #f56565;
}

.toast.warning {
    background: #ed8936;
}

.toast.info {
    background: #4299e1;
}

/* Confirmation Dialog */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.confirm-dialog.show {
    display: flex;
}

.confirm-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
}

.confirm-content h3 {
    margin-bottom: 15px;
    color: #333;
}

.confirm-content p {
    margin-bottom: 20px;
    color: #666;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Domain Detail Page */
.domain-detail-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.domain-detail-header h1 {
    margin: 0;
    color: #333;
}

.domain-info-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.domain-info-card h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
}

.info-item span {
    font-size: 14px;
    color: #333;
}

/* Logs Section */
.logs-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logs-section h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 20px;
}

.logs-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.logs-container {
    max-height: 600px;
    overflow-y: auto;
}

.log-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-left: 4px solid #4299e1;
    background: #f7fafc;
    margin-bottom: 8px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
}

.log-item.log-error {
    border-left-color: #f56565;
    background: #fff5f5;
}

.log-item.log-success {
    border-left-color: #48bb78;
    background: #f0fff4;
}

.log-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.log-time-compact {
    font-size: 13px;
    color: #666;
    font-weight: 600;
    min-width: 80px;
    flex-shrink: 0;
}

.log-message {
    color: #333;
    font-size: 13px;
    flex: 1;
}

.log-time {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.log-action {
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    font-size: 12px;
    margin-bottom: 5px;
}

.log-data {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 5px;
    font-family: monospace;
    font-size: 12px;
    color: #333;
    overflow-x: auto;
}
