/* ============================================
   DEFY AUTOMAÇÕES - Sistema de Disparos WhatsApp
   ============================================ */

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #25D366;
    --primary-dark: #128C7E;
    --secondary-color: #075E54;
    --accent-color: #34B7F1;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --dark-color: #1a1a2e;
    --darker-color: #16213e;
    --light-color: #f8f9fa;
    --gray-color: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
    --gray-bg: #e8eaed;
    --green-gradient: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

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

a:hover {
    color: var(--primary-color);
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark-color) 0%, var(--darker-color) 100%);
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--primary-dark);
    font-size: 28px;
    margin-bottom: 5px;
}

.login-header p {
    color: var(--gray-color);
    font-size: 14px;
}

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

/* ============================================
   APP LAYOUT
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--dark-color) 0%, var(--darker-color) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    height: 40px;
    width: auto;
}

.nav-menu {
    list-style: none;
    padding: 15px 0;
    flex: 1;
}

.nav-item {
    margin: 5px 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: white;
    border-radius: 0.75rem;
    transition: var(--transition);
    border: 1px solid #25D366;
}

.nav-link:hover {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.1), rgba(18, 140, 126, 0.1));
    color: #128C7E;
    border-color: #128C7E;
}

.nav-link.active {
    background: var(--green-gradient);
    color: white;
    border-color: #128C7E;
}

.nav-icon {
    margin-right: 12px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    margin-bottom: 15px;
}

.user-name {
    display: block;
    font-weight: 600;
    color: white;
}

.user-instance {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 3px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    background: #f0f2f5;
}

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

.page-header h1 {
    font-size: 28px;
    color: var(--dark-color);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.card-header h2 {
    font-size: 18px;
    color: var(--dark-color);
    margin: 0;
}

.card-body {
    padding: 25px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-secondary {
    background: var(--gray-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

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

.btn-warning {
    background: var(--warning-color);
    color: #333;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

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

.btn-outline:hover {
    background: var(--light-color);
    color: var(--dark-color);
}

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

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.form-control-sm {
    padding: 8px 12px;
    font-size: 13px;
}

.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--gray-color);
}

.form-inline {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-inline .form-group {
    margin-bottom: 0;
}

.form-inline .flex-grow {
    flex: 1;
    min-width: 300px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

input[type="file"] {
    padding: 10px;
    background: var(--light-color);
}

input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 5px;
    cursor: pointer;
}

/* ============================================
   TABLES
   ============================================ */
.table-responsive {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: #fafafa;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 13px;
    text-transform: uppercase;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.table .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

.badge-admin {
    background: var(--danger-color);
    color: white;
}

.badge-client {
    background: var(--primary-color);
    color: white;
}

.badge-success {
    background: rgba(40, 167, 69, 0.15);
    color: var(--success-color);
}

.badge-danger {
    background: rgba(220, 53, 69, 0.15);
    color: var(--danger-color);
}

.badge-warning {
    background: rgba(255, 193, 7, 0.15);
    color: #856404;
}

.badge-info {
    background: rgba(23, 162, 184, 0.15);
    color: var(--info-color);
}

.badge-secondary {
    background: rgba(108, 117, 125, 0.15);
    color: var(--gray-color);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: rgba(40, 167, 69, 0.15);
    color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.alert-error {
    background: rgba(220, 53, 69, 0.15);
    color: var(--danger-color);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    font-size: 40px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-label {
    font-size: 14px;
    color: var(--gray-color);
}

/* ============================================
   QUICK ACTIONS
   ============================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 20px;
    background: var(--light-color);
    border-radius: var(--radius);
    transition: var(--transition);
    text-align: center;
}

.quick-action-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

.quick-action-btn .icon {
    font-size: 30px;
    margin-bottom: 10px;
}

/* ============================================
   TAGS
   ============================================ */
.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    color: white;
    margin: 2px;
}

.tags-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-checkbox {
    cursor: pointer;
}

.tag-checkbox input {
    display: none;
}

.tag-checkbox input:checked + .tag {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2);
}

.tags-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tag-card {
    background: var(--light-color);
    padding: 15px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 15px;
}

.tag-preview {
    padding: 8px 15px;
    border-radius: 20px;
    color: white;
    font-weight: 500;
}

.tag-info {
    flex: 1;
}

.tag-count {
    font-size: 12px;
    color: var(--gray-color);
}

.tag-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   TAGS PAGE IMPROVEMENTS
   ============================================ */

.page-subtitle {
    font-size: 14px;
    color: var(--gray-color);
    margin-top: 5px;
}

.tags-page-container {
    display: grid;
    gap: 25px;
}

/* Create Tag Card */
.tags-create-card {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.05), rgba(18, 140, 126, 0.05));
    border: 2px solid var(--border-color);
}

.tags-create-card .card-header {
    background: linear-gradient(135deg, #f0fdf4, #f0f9f7);
    border-bottom: 2px solid var(--primary-color);
}

.tags-create-form {
    width: 100%;
}

.tags-form-row {
    display: grid;
    grid-template-columns: 1fr 200px auto;
    gap: 20px;
    align-items: center;
}

.tags-color-group {
    margin-bottom: 0;
}

.tags-color-group label {
    display: block;
    margin-bottom: 8px;
}

.color-picker-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    height: 44px;
}

.color-picker {
    width: 60px;
    height: 44px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.color-picker:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.color-preview {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    flex-shrink: 0;
}

.tags-button-group {
    margin-bottom: 0;
}

.tags-button-group .btn {
    height: 100%;
}

.tags-button-group {
    margin-bottom: 0;
}

.tags-button-group .btn {
    width: 100%;
}

/* Tags List Card */
.tags-list-card {
    border: 1px solid var(--border-color);
}

.tags-list-card .card-header {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-title h2 {
    margin: 0;
}

.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
}

/* Tags Grid */
.tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Enhanced Tag Card */
.tag-card-enhanced {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: var(--shadow);
}

.tag-card-enhanced:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-4px);
}

.tag-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tag-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.tag-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--dark-color);
    word-break: break-word;
}

.tag-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tag-preview-large {
    padding: 16px;
    border-radius: var(--radius);
    color: white;
    font-weight: 600;
    text-align: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tag-stats {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: center;
    flex-direction: column;
}

.stat-icon {
    font-size: 20px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-label {
    font-size: 11px;
    color: var(--gray-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.tag-card-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: 12px;
}

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

.empty-icon {
    font-size: 64px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-text {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--dark-color);
}

.empty-subtext {
    font-size: 14px;
    margin: 0;
    opacity: 0.8;
}

/* Edit Modal */
.tags-edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.tags-edit-modal .modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
}

.tags-edit-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.tags-edit-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--dark-color);
}

.tags-edit-modal .modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-color);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.tags-edit-modal .modal-close:hover {
    color: var(--dark-color);
    transform: rotate(90deg);
}

/* ============================================
   CONTACTS SELECTOR (BROADCAST)
   ============================================ */
.contacts-selector {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.selector-header {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #fafafa;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.contacts-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
}

.contact-checkbox {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.contact-checkbox:hover {
    background: var(--light-color);
}

.contact-checkbox input {
    margin-right: 12px;
    width: 18px;
    height: 18px;
}

.contact-checkbox .contact-info {
    display: flex;
    flex-direction: column;
}

.contact-checkbox .contact-info small {
    color: var(--gray-color);
    font-size: 12px;
}

.selected-count {
    padding: 15px;
    background: var(--light-color);
    border-radius: var(--radius);
    text-align: center;
    font-weight: 500;
    margin-top: 15px;
}

/* Phone Preview */
.phone-preview {
    display: flex;
    justify-content: center;
}

.phone-messages {
    padding: 20px;
    min-height: 300px;
}

.message-bubble {
    background: white;
    padding: 10px 15px;
    border-radius: 10px;
    border-top-left-radius: 0;
    max-width: 90%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.preview-image {
    margin-bottom: 10px;
}

.preview-image img {
    max-width: 100%;
    border-radius: 5px;
}

.preview-text {
    word-wrap: break-word;
    font-size: 14px;
}

.preview-text .placeholder {
    color: var(--gray-color);
    font-style: italic;
}

.preview-file {
    margin-top: 10px;
    padding: 8px;
    background: var(--light-color);
    border-radius: 5px;
    font-size: 12px;
}

.message-time {
    display: block;
    text-align: right;
    font-size: 11px;
    color: var(--gray-color);
    margin-top: 5px;
}

/* ============================================
   CAMPAIGN STATS
   ============================================ */
.campaign-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-box {
    background: var(--light-color);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
}

.stat-box .stat-label {
    display: block;
    font-size: 12px;
    color: var(--gray-color);
    margin-bottom: 5px;
}

.stat-box .stat-value {
    font-size: 28px;
    font-weight: 700;
}

.stat-box.stat-success .stat-value {
    color: var(--success-color);
}

.stat-box.stat-danger .stat-value {
    color: var(--danger-color);
}

.stat-box.stat-warning .stat-value {
    color: #856404;
}

/* Progress Bar */
.progress-section {
    margin-bottom: 25px;
}

.progress-bar-container,
.progress-bar-large {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-large {
    height: 20px;
    border-radius: 10px;
}

.progress-bar,
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    transition: width 0.5s ease;
}

.progress-text {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    color: var(--gray-color);
}

.campaign-actions {
    text-align: center;
    margin-top: 20px;
}

/* Message Content Preview */
.message-content-preview {
    background: var(--light-color);
    padding: 20px;
    border-radius: var(--radius);
}

.message-content-preview .message-image {
    margin-bottom: 15px;
}

.message-content-preview .message-image img {
    max-width: 300px;
    border-radius: var(--radius);
}

.message-content-preview .message-text {
    white-space: pre-wrap;
    line-height: 1.8;
}

.message-content-preview .message-file {
    margin-top: 15px;
    padding: 10px;
    background: white;
    border-radius: var(--radius);
}

/* ============================================
   MESSAGE HISTORY
   ============================================ */
.message-history {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-item {
    background: var(--light-color);
    padding: 15px;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
}

.message-item.received {
    border-left-color: var(--info-color);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.message-direction {
    font-weight: 500;
}

.message-campaign {
    font-size: 12px;
    color: var(--gray-color);
}

.message-date {
    font-size: 12px;
    color: var(--gray-color);
}

.message-content {
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Contact Info */
.contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    padding: 10px;
    background: var(--light-color);
    border-radius: var(--radius);
}

/* ============================================
   FILTERS
   ============================================ */
.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.filter-tags {
    min-width: 200px;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-color);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-color);
}

.empty-state p {
    margin-bottom: 20px;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-muted {
    color: var(--gray-color);
}

.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

/* ============================================
   BROADCAST DESIGN IMPROVEMENTS
   ============================================ */

/* Broadcast Cards */
.broadcast-card {
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.broadcast-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.broadcast-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 2px solid var(--border-color);
}

/* Tags Selector Broadcast */
.tags-selector-broadcast {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.tag-checkbox-broadcast {
    cursor: pointer;
}

.tag-checkbox-broadcast input {
    display: none;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 20px;
    color: white;
    font-weight: 500;
    font-size: 13px;
    transition: var(--transition);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
    opacity: 0.65;
}

.tag-checkbox-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    opacity: 0;
    transform: scale(0);
    transition: var(--transition);
    flex-shrink: 0;
}

.tag-checkbox-broadcast input:checked + .tag-badge {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25), 0 0 0 4px rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
}

.tag-checkbox-broadcast input:checked + .tag-badge .tag-checkbox-mark {
    opacity: 1;
    transform: scale(1);
    background: rgba(255, 255, 255, 0.7);
}

/* Contacts Selector Broadcast */
.contacts-selector-broadcast {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.selector-header-broadcast {
    display: flex;
    gap: 8px;
    padding: 15px;
    background: #fafafa;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    align-items: center;
}

.selector-header-broadcast .search-input {
    flex: 1;
    min-width: 200px;
}

.contacts-list-broadcast {
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

/* Contact Item Broadcast */
.contact-item-broadcast {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.contact-item-broadcast:hover {
    background: #f8f9fa;
    padding-left: 20px;
}

.contact-item-broadcast input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.contact-avatar-broadcast {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}

.contact-details-broadcast {
    flex: 1;
    min-width: 0;
}

.contact-name-broadcast {
    font-weight: 500;
    color: var(--dark-color);
    margin-bottom: 2px;
}

.contact-phone-broadcast {
    font-size: 12px;
    color: var(--gray-color);
    margin-bottom: 4px;
}

.contact-tags-broadcast {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.tag-mini {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    color: var(--dark-color);
}

/* Selected Badge in Header */
.selected-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.1), rgba(18, 140, 126, 0.1));
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary-dark);
}

.badge-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 11px;
}

/* Summary Box */
.summary-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-top: 2px solid var(--primary-color);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.summary-label {
    font-weight: 500;
    color: var(--dark-color);
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.form-actions-broadcast {
    display: flex;
    gap: 10px;
}

.form-actions-broadcast .btn {
    flex: 1;
    justify-content: center;
}

/* Sticky Preview */
.sticky-preview {
    position: sticky;
    top: 30px;
}

/* Phone Preview Enhancement */
.phone-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    margin-bottom: 8px;
    padding: 0 10px;
}

.phone-frame {
    width: 280px;
    background: #e5ddd5;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 12px solid #222;
    border-top-width: 30px;
    border-bottom-width: 30px;
    position: relative;
}

.phone-frame::before {
    content: '';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 20px;
    background: #222;
    border-radius: 0 0 15px 15px;
    z-index: 10;
}

.phone-header {
    background: var(--secondary-color);
    color: white;
    padding: 10px 12px 5px 12px;
    text-align: center;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.phone-contact {
    font-weight: 600;
    display: block;
    margin-top: 3px;
}

.phone-messages {
    padding: 15px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(to bottom, #ece5dd 0%, #e5ddd5 100%);
}

.preview-body {
    padding: 15px;
    background: #f5f5f5;
}

.preview-body .phone-preview {
    display: flex;
    justify-content: center;
    padding: 10px 0;
}

/* Broadcast Container Layout */
.broadcast-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 25px;
}

.broadcast-form-container {
    min-width: 0;
}

.broadcast-preview-container {
    position: sticky;
    top: 30px;
    height: fit-content;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .broadcast-container {
        grid-template-columns: 1fr;
    }
    
    .broadcast-preview-container {
        position: static;
    }
}

@media (max-width: 992px) {
    .campaign-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .app-container {
        flex-direction: column;
    }
    
    .nav-menu {
        display: flex;
        flex-wrap: wrap;
        padding: 10px;
    }
    
    .nav-item {
        margin: 3px;
    }
    
    .sidebar-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .user-info {
        margin-bottom: 0;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .campaign-stats {
        grid-template-columns: 1fr 1fr;
    }
    
    .form-inline {
        flex-direction: column;
    }
    
    .form-inline .form-group,
    .form-inline .flex-grow {
        width: 100%;
        min-width: auto;
    }
    
    /* Broadcast adjustments for tablet */
    .broadcast-container {
        grid-template-columns: 1fr;
    }
    
    .selector-header-broadcast {
        flex-direction: column;
    }
    
    .selector-header-broadcast .btn,
    .selector-header-broadcast .search-input {
        width: 100%;
    }
    
    /* Tags Page on Tablet */
    .tags-form-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .tags-button-group {
        grid-column: 1 / -1;
    }
    
    .tags-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 13px;
    }
    
    /* Broadcast on mobile */
    .contact-item-broadcast {
        padding: 10px;
    }
    
    .contact-avatar-broadcast {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .phone-frame {
        width: 240px;
        border: 10px solid #222;
        border-top-width: 25px;
        border-bottom-width: 25px;
    }
    
    .phone-frame::before {
        width: 120px;
        height: 18px;
        top: -22px;
    }
    
    .summary-box {
        padding: 15px;
    }
    
    .summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    /* Tags Page on Mobile */
    .tags-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
        align-items: stretch;
    }
    
    .color-picker-wrapper {
        height: auto;
    }
    
    .tags-button-group .btn {
        height: auto;
        padding: 12px 20px;
    }
    
    .color-picker-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .tags-button-group .btn {
        width: 100%;
    }
    
    .tags-grid {
        grid-template-columns: 1fr;
    }
    
    .tag-card-actions {
        flex-direction: column;
    }
    
    .tag-card-actions .btn {
        width: 100%;
    }
}
