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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: #25d366;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.connection-status.connected i {
    color: #4caf50;
}

.connection-status.disconnected i {
    color: #f44336;
}

.connection-status.connecting i {
    color: #ff9800;
    animation: pulse 1s infinite;
}

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

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.conversations-panel {
    width: 350px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.conversations-header {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.conversations-header h3 {
    color: #333;
    font-size: 1.1rem;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.conversation-item:hover {
    background-color: #f5f5f5;
}

.conversation-item.active {
    background-color: #e3f2fd;
}

.conversation-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #25d366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.conversation-time {
    color: #999;
    font-size: 0.8rem;
}

.unread-badge {
    background: #25d366;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #e5ddd5;
}

.chat-header {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-info i {
    font-size: 2rem;
    color: #999;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ddd6cc' fill-opacity='0.1'%3E%3Cpath d='m0 40l40-40h-40v40zm40 0v-40h-40l40 40z'/%3E%3C/g%3E%3C/svg%3E");
}

.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #666;
}

.welcome-message i {
    font-size: 4rem;
    color: #25d366;
    margin-bottom: 1rem;
}

.welcome-message h3 {
    margin-bottom: 0.5rem;
}

.message {
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.message.outbound {
    flex-direction: row-reverse;
}

.message-bubble {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

.message.inbound .message-bubble {
    background: white;
    border-bottom-left-radius: 4px;
}

.message.outbound .message-bubble {
    background: #dcf8c6;
    border-bottom-right-radius: 4px;
}

.message-content {
    margin-bottom: 0.25rem;
}

.message-meta {
    font-size: 0.75rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.message.outbound .message-meta {
    justify-content: flex-end;
}

.message-status {
    display: inline-flex;
    align-items: center;
}

.status-sent { color: #999; }
.status-delivered { color: #999; }
.status-read { color: #25d366; }

.message-input-container {
    background: white;
    padding: 1rem 2rem;
    border-top: 1px solid #e0e0e0;
}

.input-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

#messageInput {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    outline: none;
    font-size: 1rem;
    resize: none;
}

#messageInput:focus {
    border-color: #25d366;
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #25d366;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.send-btn:hover:not(:disabled) {
    background: #128c7e;
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.message-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.btn-icon:hover {
    background: #f0f0f0;
}

.char-count {
    color: #999;
    font-size: 0.8rem;
}

.quick-actions {
    background: white;
    padding: 1rem 2rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 1rem;
}

.action-btn {
    background: #25d366;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background: #128c7e;
}

.no-conversations {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #999;
    text-align: center;
}

.no-conversations i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

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

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    animation: slideIn 0.3s;
}

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

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #25d366;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.8rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-primary {
    background: #25d366;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    background: #128c7e;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e0e0e0;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #25d366;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Media attachments */
.message-media {
    margin-bottom: 0.5rem;
    border-radius: 8px;
    overflow: hidden;
    max-width: 300px;
}

.message-media img,
.message-media video {
    width: 100%;
    height: auto;
    display: block;
}

.message-document {
    background: #f0f0f0;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.document-icon {
    width: 40px;
    height: 40px;
    background: #25d366;
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-size {
    color: #666;
    font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .conversations-panel {
        width: 100%;
        position: absolute;
        z-index: 100;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .conversations-panel.show {
        transform: translateX(0);
    }

    .chat-panel {
        width: 100%;
    }

    .main-content {
        position: relative;
    }

    .modal-content {
        margin: 5% auto;
        width: 95%;
    }

    .quick-actions {
        flex-wrap: wrap;
    }
}

/* Templates Modal Styles */
.templates-container {
    max-height: 60vh;
    overflow-y: auto;
}

.templates-filters {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.templates-filters select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
}

.templates-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.template-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    background: #f9f9f9;
    transition: box-shadow 0.2s;
}

.template-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.template-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.template-category {
    background: #25d366;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    text-transform: capitalize;
}

.template-content {
    background: white;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    white-space: pre-wrap;
    font-family: inherit;
    border: 1px solid #e8e8e8;
}

.template-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.template-actions .btn-secondary {
    background: #6c757d;
    color: white;
}

.template-actions .btn-secondary:hover {
    background: #545b62;
}

.use-template-btn {
    background: #25d366;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.use-template-btn:hover {
    background: #128c7e;
}

.loading-templates,
.error-message,
.no-templates {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.error-message {
    color: #f44336;
}

/* Adjust modal content for templates */
#templatesModal .modal-content {
    max-width: 600px;
    max-height: 80vh;
}

#templatesModal .modal-body {
    max-height: calc(80vh - 120px);
    overflow: hidden;
}

/* Template meta styling */
.template-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.template-language {
    background: #2196f3;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.template-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.status-approved {
    background: #4caf50;
    color: white;
}

.status-pending {
    background: #ff9800;
    color: white;
}

.status-rejected {
    background: #f44336;
    color: white;
}

/* Template content components */
.template-header-content {
    background: #e3f2fd;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.template-body-content {
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    white-space: pre-wrap;
    border-left: 3px solid #25d366;
}

.template-footer-content {
    background: #f5f5f5;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.template-buttons-content {
    background: #fff3e0;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.no-content {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* Template parameters form */
.template-params-form,
.initiate-conversation-form {
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.template-params-form h4,
.initiate-conversation-form h4 {
    margin-bottom: 1rem;
    color: #333;
}

.template-preview,
.template-info {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    white-space: pre-wrap;
    border-left: 3px solid #25d366;
}

.template-info strong {
    color: #333;
    display: block;
    margin-bottom: 0.5rem;
}

.initiate-conversation-form h5 {
    margin: 1rem 0 0.5rem 0;
    color: #555;
    font-size: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Image URL input styling */
.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.image-preview {
    margin-top: 10px;
    text-align: center;
}

.image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.remove-image-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.remove-image-btn:hover {
    background: #c82333;
}

/* Templates warning */
.templates-warning {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #fff3e0;
    border: 1px solid #ff9800;
    border-radius: 8px;
    border-left: 4px solid #ff9800;
}

.warning-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.warning-content i {
    color: #ff9800;
    font-size: 1.2rem;
    align-self: flex-start;
}

.warning-content strong {
    color: #e65100;
    font-size: 1.1rem;
}

.warning-content p {
    color: #bf360c;
    margin: 0;
    line-height: 1.4;
}

.warning-content small {
    color: #666;
    font-style: italic;
}

/* Custom Alert Styles */
.custom-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideInRight 0.3s ease-out;
}

.custom-alert.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.custom-alert.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-content {
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-content i {
    font-size: 1.25rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.custom-alert.success i {
    color: #28a745;
}

.custom-alert.error i {
    color: #dc3545;
}

.alert-message {
    flex: 1;
    white-space: pre-line;
    line-height: 1.4;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-close:hover {
    opacity: 1;
}

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

/* Campaigns Modal Styles */
.campaigns-modal {
    z-index: 1001;
}

.campaigns-modal .modal-content {
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    height: auto;
    margin: 7.5vh auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.campaigns-modal .modal-header {
    flex-shrink: 0;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #dee2e6;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.campaigns-modal .modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.campaigns-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 300px;
    max-height: calc(85vh - 100px);
}

.campaigns-modal .modal-body::-webkit-scrollbar {
    width: 6px;
}

.campaigns-modal .modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.campaigns-modal .modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.campaigns-modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.campaigns-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin: 0;
    padding: 0 1.25rem;
    flex-shrink: 0;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.campaigns-tabs .tab-btn {
    background: none;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.campaigns-tabs .tab-btn.active,
.campaigns-tabs .tab-btn:hover {
    color: #007bff;
    border-bottom-color: #007bff;
}

.tab-content {
    display: none;
    padding: 1rem 1.5rem;
    min-height: 250px;
    overflow-y: auto;
    max-height: calc(85vh - 160px);
}

.tab-content.active {
    display: block;
}

/* Campaign Form */
.campaign-summary {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.75rem;
    margin-top: 0.75rem;
}

.summary-content {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    min-width: 150px;
}

.summary-item span:first-child {
    font-weight: 500;
    color: #495057;
}

.summary-item span:last-child {
    font-weight: bold;
    color: #007bff;
}

/* Campaign List */
.campaign-item {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.campaign-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.campaign-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.campaign-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.campaign-status.status-pending {
    background: #fff3cd;
    color: #856404;
}

.campaign-status.status-running {
    background: #d4edda;
    color: #155724;
}

.campaign-status.status-completed {
    background: #cce7ff;
    color: #004085;
}

.campaign-status.status-failed {
    background: #f8d7da;
    color: #721c24;
}

.campaign-status.status-scheduled {
    background: #e2e3e5;
    color: #383d41;
}

.campaign-details {
    padding: 1rem;
}

.campaign-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.campaign-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.campaign-meta i {
    color: #007bff;
    width: 16px;
}

.campaign-progress {
    margin-bottom: 1rem;
}

.progress-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
}

.stat-item i {
    color: #28a745;
}

.campaign-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 4px;
    border: 1px solid;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-small.btn-primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.btn-small.btn-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.btn-small.btn-secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.btn-small.btn-secondary:hover {
    background: #545b62;
    border-color: #545b62;
}

/* Analytics Dashboard */
.analytics-overview {
    max-width: 100%;
}

.analytics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.analytics-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.analytics-card .card-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(45deg, #007bff, #0056b3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.analytics-card .card-content h3 {
    margin: 0;
    font-size: 2rem;
    color: #333;
    font-weight: bold;
}

.analytics-card .card-content p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.recent-campaigns h4 {
    margin-bottom: 1rem;
    color: #333;
}

.campaigns-table {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.table-row {
    border-bottom: 1px solid #eee;
}

.table-row:last-child {
    border-bottom: none;
}

.row-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    align-items: center;
}

.campaign-name {
    font-weight: 500;
    color: #333;
}

.campaign-template {
    color: #666;
    font-size: 0.9rem;
}

.campaign-recipients {
    color: #666;
    font-size: 0.9rem;
}

.no-campaigns {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.no-campaigns i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #ddd;
}

.no-campaigns p {
    margin: 0;
    font-size: 1.1rem;
}

.error-message {
    text-align: center;
    padding: 2rem;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

.loading-campaigns,
.loading-analytics {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* Form improvements */
#createCampaignForm .form-group {
    margin-bottom: 1rem;
}

#createCampaignForm label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: #495057;
}

#createCampaignForm input,
#createCampaignForm select,
#createCampaignForm textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#createCampaignForm input:focus,
#createCampaignForm select:focus,
#createCampaignForm textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#createCampaignForm small {
    display: block;
    margin-top: 0.2rem;
    color: #6c757d;
    font-size: 0.8rem;
    line-height: 1.3;
}

#createCampaignForm .modal-actions {
    margin-top: 1.5rem;
    padding: 0.75rem 0;
    border-top: 1px solid #dee2e6;
    background: white;
    position: sticky;
    bottom: -1rem;
    z-index: 10;
    margin-bottom: -1rem;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* Textarea specific */
#campaignRecipients {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    resize: vertical;
    min-height: 100px;
    max-height: 150px;
}

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .campaigns-modal .modal-content {
        width: 95%;
        max-width: 700px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .campaigns-modal .modal-content {
        width: 96%;
        max-width: 650px;
        max-height: 90vh;
        margin: 5vh auto;
        border-radius: 8px;
    }

    .campaigns-modal .modal-header {
        padding: 0.6rem 1rem;
    }

    .campaigns-modal .modal-body {
        max-height: calc(90vh - 90px);
    }

    .campaigns-tabs {
        flex-wrap: wrap;
        padding: 0 1rem;
    }

    .campaigns-tabs .tab-btn {
        flex: 1;
        min-width: calc(33.333% - 0.3rem);
        margin: 0.15rem;
        text-align: center;
        border: 1px solid #dee2e6;
        border-radius: 3px;
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .campaigns-tabs .tab-btn.active {
        background: #007bff;
        color: white;
        border-color: #007bff;
    }

    .tab-content {
        padding: 0.75rem 1rem;
        max-height: calc(90vh - 140px);
    }

    #createCampaignForm .form-group {
        margin-bottom: 0.8rem;
    }

    #campaignRecipients {
        min-height: 80px;
        max-height: 120px;
    }

    .analytics-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .analytics-card {
        padding: 1rem;
    }

    .analytics-card .card-content h3 {
        font-size: 1.5rem;
    }

    .row-content {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .summary-content {
        flex-direction: column;
    }

    .campaign-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .campaign-actions {
        flex-direction: column;
    }

    .btn-small {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .campaigns-modal .modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .campaigns-modal .modal-body {
        max-height: calc(100vh - 110px);
    }

    .campaigns-modal .modal-header {
        padding: 0.5rem;
    }

    .campaigns-modal .modal-header h3 {
        font-size: 1rem;
    }

    .campaigns-tabs {
        padding: 0 0.5rem;
        flex-direction: column;
    }

    .campaigns-tabs .tab-btn {
        width: 100%;
        margin: 0.05rem 0;
        font-size: 0.75rem;
        padding: 8px 10px;
        border-radius: 4px;
        border: 1px solid #dee2e6;
    }

    .campaigns-tabs .tab-btn.active {
        background: #007bff;
        color: white;
        border-color: #007bff;
    }

    .tab-content {
        padding: 0.5rem;
        max-height: calc(100vh - 170px);
    }

    #createCampaignForm .form-group {
        margin-bottom: 0.6rem;
    }

    #createCampaignForm input,
    #createCampaignForm select,
    #createCampaignForm textarea {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    #createCampaignForm .modal-actions {
        padding: 0.6rem 0;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        bottom: -0.5rem;
        margin-bottom: -0.5rem;
    }

    #campaignRecipients {
        min-height: 60px;
        max-height: 100px;
        font-size: 0.8rem;
    }

    .analytics-cards {
        grid-template-columns: 1fr;
    }

    .analytics-card .card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Image Upload Styles */
.image-upload-group {
    margin-bottom: 1rem;
}

.image-upload-container {
    position: relative;
}

.image-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.image-upload-area {
    border: 2px dashed #25d366;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8fff9;
}

.image-upload-area:hover {
    border-color: #20b856;
    background: #f0fff1;
}

.image-upload-area i {
    font-size: 2rem;
    color: #25d366;
    margin-bottom: 0.5rem;
}

.image-upload-area p {
    margin: 0.5rem 0;
    color: #333;
    font-weight: 500;
}

.image-upload-area small {
    color: #666;
    font-size: 0.8rem;
}

.image-preview {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    max-width: 300px;
    margin: 0 auto;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(244, 67, 54, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.remove-image-btn:hover {
    background: rgba(244, 67, 54, 1);
}

.template-header-content.image-header {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 4px solid #2196f3;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.header-image-info {
    font-size: 0.8rem;
    color: #1976d2;
    margin-top: 0.25rem;
    font-style: italic;
}