* {
    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;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.header {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.logo h1 {
    color: #ff6b00;
    font-size: 2em;
    margin-bottom: 5px;
}

.logo p {
    color: #666;
    font-size: 0.9em;
}

.author-info {
    text-align: right;
    color: #666;
    font-size: 0.9em;
}

.author-info p {
    margin: 5px 0;
}

/* Card */
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

/* QR Section */
.qr-section {
    text-align: center;
}

.qr-section h2 {
    color: #333;
    margin-bottom: 10px;
}

.qr-section p {
    color: #666;
    margin-bottom: 20px;
}

.qr-code {
    display: inline-block;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
    min-height: 200px;
    min-width: 200px;
}

/* Status Section */
.status-section {
    text-align: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1em;
    font-weight: 500;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: #4caf50;
}

.status-dot.offline {
    background: #f44336;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.form-control:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #666;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

.checkbox-label span {
    font-weight: 500;
    color: #333;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-message {
    background: white;
    border: 2px solid #e0e0e0;
    color: #333;
    width: 100%;
    margin-bottom: 10px;
}

.btn-message:hover {
    border-color: #667eea;
    color: #667eea;
}

.btn-message.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-secondary {
    background: #757575;
    color: white;
}

/* Message Types */
.message-types {
    margin-bottom: 20px;
}

/* Info Box */
.info-box {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.info-box p {
    margin: 8px 0;
    color: #333;
}

.info-box strong {
    color: #667eea;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50 0%, #8bc34a 100%);
    width: 0%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.progress-text {
    text-align: center;
    color: #333;
    font-weight: 500;
}

/* Log Section */
.log-container {
    max-height: 300px;
    overflow-y: auto;
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
}

.log-empty {
    text-align: center;
    color: #999;
    padding: 20px;
}

.log-entry {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 5px;
    border-left: 4px solid #667eea;
    background: white;
}

.log-entry.success {
    border-left-color: #4caf50;
}

.log-entry.error {
    border-left-color: #f44336;
}

.log-entry.info {
    border-left-color: #2196f3;
}

.log-time {
    font-size: 0.85em;
    color: #999;
    margin-bottom: 5px;
}

.log-message {
    color: #333;
}

/* Footer Actions */
.footer-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.footer-actions .btn {
    min-width: 150px;
}

/* Scrollbar */
.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Database Viewer */
.db-viewer-card {
    margin-top: 20px;
}

.db-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.db-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

.stat-value.stat-pending {
    color: #ff9800;
}

.stat-value.stat-failed {
    color: #f44336;
}

.db-container {
    max-height: 400px;
    overflow-y: auto;
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
}

.db-entry {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.db-entry.duplicate {
    border-left-color: #ff9800;
    background: #fff9f0;
}

.db-entry.pending {
    border-left-color: #ff9800;
    background: #fffbf0;
}

.db-entry.failed {
    border-left-color: #f44336;
    background: #fff5f5;
}

.db-entry.sent {
    border-left-color: #4caf50;
    background: #f5fff5;
}

.db-entry-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 500;
}

.db-entry-phone {
    color: #667eea;
    font-size: 1.1em;
}

.db-entry-date {
    color: #999;
    font-size: 0.85em;
}

.db-entry-message {
    color: #333;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 5px;
    margin-top: 10px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.db-entry-hash {
    font-size: 0.75em;
    color: #999;
    margin-top: 5px;
    font-family: monospace;
}

.db-container::-webkit-scrollbar {
    width: 8px;
}

.db-container::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 4px;
}

.db-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.db-container::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}


/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}


/* History Modal Styles */
.filter-btn {
    background: #f3f4f6;
    color: #6b7280;
}

.filter-btn:hover {
    background: #e5e7eb;
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#historyTableBody tr {
    border-bottom: 1px solid #e5e7eb;
}

#historyTableBody tr:hover {
    background: #f9fafb;
}

#historyTableBody td {
    padding: 12px 16px;
    font-size: 14px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
}

.status-sent {
    background: #d1fae5;
    color: #065f46;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}
