* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f6f7fb;
    color: #222;
}

.auth-container {
    max-width: 420px;
    margin: 80px auto;
    padding: 20px;
}

.auth-container h1 {
    margin-bottom: 8px;
}

.auth-container p {
    color: #666;
}

.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

label {
    display: block;
    font-size: 13px;
    margin: 12px 0 6px;
    color: #555;
}

input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
}

button {
    margin-top: 16px;
    border: none;
    border-radius: 8px;
    background: #222;
    color: #fff;
    padding: 10px 14px;
    cursor: pointer;
}

button.primary {
    background: #222;
}

button.secondary {
    background: #9a2e2e;
}

.error-message {
    color: #b00020;
    min-height: 18px;
    font-size: 13px;
    margin-top: 10px;
}

.back-link {
    display: inline-block;
    margin-top: 14px;
    color: #0047ab;
    text-decoration: none;
}

.admin-header {
    background: #fff;
    border-bottom: 1px solid #ddd;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-header h1 {
    margin: 0;
    font-size: 22px;
}

.admin-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
}

.admin-main {
    padding: 20px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1100px;
}

th, td {
    border: 1px solid #ddd;
    text-align: left;
    padding: 10px;
    font-size: 13px;
    vertical-align: top;
}

th {
    background: #f1f3f8;
    font-weight: 600;
}

.empty {
    text-align: center;
    color: #666;
}

.column-filters {
    margin-bottom: 20px;
}

.column-filters h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 13px;
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #f9f9f9;
    transition: 0.2s;
}

.checkbox-grid label:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.checkbox-grid label input {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

/* Columns Dropdown */
.dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.columns-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    min-width: 320px;
}

.columns-dropdown.hidden {
    display: none;
}

.dropdown-content {
    padding: 16px;
}

.dropdown-content h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

.dropdown-content .checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.dropdown-content .checkbox-grid label {
    padding: 6px 8px;
    font-size: 12px;
}

/* Modal Styles */
.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.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    margin: 0;
    width: auto;
    margin-top: 0;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin: 0 0 8px 0;
    font-weight: 600;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #999;
    font-size: 12px;
}

/* Link input group */
.link-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.link-input-group input {
    flex: 1;
}

.link-input-group button {
    padding: 8px 12px;
    white-space: nowrap;
    font-size: 13px;
}

#linkPasteArea {
    resize: vertical;
}

/* Thumbnail preview styles */
#thumbnailPreview {
    background: #f9f9f9;
}

#thumbnailImg {
    display: block;
}

#thumbnailTitle {
    word-break: break-word;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.modal-actions button {
    flex: 1;
    padding: 12px 16px;
    margin: 0;
}

.modal-actions button.primary {
    background: #222;
}

.modal-actions button.secondary {
    background: #999;
}

.analytics-card {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.analytics-card:hover {
    transform: translateY(-2px);
    border-color: #b7c9e8 !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.analytics-details-list {
    display: grid;
    gap: 12px;
}

.analytics-detail-item {
    border: 1px solid #e3e6eb;
    border-radius: 10px;
    padding: 14px 16px;
    background: #fafbfe;
}

.analytics-detail-item h4 {
    margin: 0 0 6px;
    font-size: 15px;
    color: #1f2937;
}

.analytics-detail-item p {
    margin: 4px 0;
    font-size: 13px;
    color: #4b5563;
    word-break: break-word;
}

.analytics-detail-item .analytics-error {
    color: #b42318;
    font-weight: 600;
}

.analytics-empty-state {
    text-align: center;
    color: #666;
    font-size: 14px;
    padding: 18px 12px;
}

/* Row checkbox styles */
tbody tr {
    position: relative;
}

tbody tr input[type="checkbox"],
th input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
    padding: 0;
}

/* Generic hidden class */
/* Delete button container styles */
.delete-button-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    align-items: stretch !important;
    justify-content: flex-end !important;
}

.delete-button {
    background-color: #dc3545 !important;
    color: white !important;
    padding: 12px 20px !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3) !important;
    transition: background-color 0.2s !important;
    margin: 0 !important;
    height: 44px !important;
    min-height: 44px !important;
    line-height: 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
}

.delete-button:hover {
    background-color: #c82333 !important;
}

.delete-button:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(220, 53, 69, 0.3) !important;
}

/* Hidden class - must come after button styles to override display: flex */
.hidden {
    display: none !important;
}

/* Pagination styles */
.pagination-container {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 6px;
}

.pagination-container.show {
    display: flex !important;
}

.page-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    transition: all 0.2s;
}

.page-btn:hover {
    background: #e3f2fd;
    border-color: #2196F3;
    color: #2196F3;
}

.page-btn.active {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== TAB STYLES ===== */
.admin-tabs {
    display: flex;
    gap: 10px;
    background: #fff;
    border-bottom: 2px solid #ddd;
    padding: 0 20px;
    margin: 0;
}

.tab-button {
    padding: 14px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
    margin: 0;
    border-radius: 0;
}

.tab-button:hover {
    color: #222;
    background: #f9f9f9;
}

.tab-button.active {
    color: #0066cc;
    border-bottom-color: #0066cc;
    background: none;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

.schedule-marketing-shell {
    max-width: 100%;
    margin: 0;
    overflow: visible;
}

.schedule-marketing-layout {
    display: flex;
    gap: 30px;
    align-items: start;
    width: 100%;
}

.schedule-marketing-main {
    flex: 1;
    min-width: 0;
}

.schedule-marketing-side {
    width: 500px;
    flex-shrink: 0;
    position: sticky;
    top: 12px;
    align-self: flex-start;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    z-index: 5;
    padding-right: 4px;
    scrollbar-width: thin;
}

.schedule-fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.schedule-preview-card {
    background: #fff;
    border: 1px solid #dfe7f2;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.schedule-preview-box {
    background: #f9fbff;
    border: 1px solid #e3eaf6;
    border-radius: 10px;
    padding: 16px;
}

.schedule-preview-label {
    font-size: 12px;
    font-weight: 700;
    color: #0b3d91;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.schedule-preview-value {
    margin-top: 8px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
}

.schedule-preview-content {
    margin-top: 8px;
    min-height: 220px;
    padding: 14px;
    background: #fff;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
    font-size: 13px;
    color: #555;
    line-height: 1.6;
    white-space: normal;
    overflow: hidden;
}

.schedule-preview-placeholder {
    color: #6b7280;
    white-space: pre-wrap;
}

.schedule-preview-richtext {
    white-space: normal;
    word-break: break-word;
}

.schedule-preview-richtext p,
.schedule-preview-richtext div {
    margin: 0 0 12px;
}

.schedule-preview-richtext p:last-child,
.schedule-preview-richtext div:last-child {
    margin-bottom: 0;
}

.schedule-preview-richtext img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.schedule-preview-html-frame {
    width: 100%;
    min-height: 420px;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
    background: #fff;
}

.schedule-preview-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.schedule-preview-media-card {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid #dfe7f2;
    border-radius: 10px;
    background: #f9fbff;
}

.schedule-preview-media-card img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    background: #fff;
}

.schedule-preview-media-card span {
    font-size: 12px;
    color: #475569;
    word-break: break-word;
}

.schedule-preview-attachment-list {
    margin-top: 16px;
    padding: 12px;
    border: 1px solid #dfe7f2;
    border-radius: 10px;
    background: #f9fbff;
}

.schedule-preview-attachment-list strong {
    display: block;
    margin-bottom: 8px;
    color: #334155;
}

.schedule-preview-attachment-list ul {
    margin: 0;
    padding-left: 18px;
    color: #475569;
}

.schedule-preview-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #25d366;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.schedule-email-open-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid #d0d7e2;
    border-radius: 8px;
    background: #fff;
    color: #0066cc;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.schedule-email-open-link:hover {
    background: #f8fbff;
    border-color: #a8c2f5;
}

/* ===== MARKETING FORM STYLES ===== */
.marketing-container {
    max-width: 700px;
    margin: 0 auto;
}

.marketing-container h2 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #222;
}

.marketing-form {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-section {
    margin-bottom: 20px;
}

.form-section label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #222;
}

.form-section small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #999;
}

.form-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    resize: vertical;
    font-family: 'Segoe UI', monospace;
}

.form-section input[type="text"],
.form-section input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
}

.rich-text-editor {
    border: 1px solid #d0d7e2;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.rich-text-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.rich-text-btn,
.rich-text-select {
    margin: 0;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1f2937;
    font-size: 12px;
    line-height: 1;
}

.rich-text-btn {
    min-width: 42px;
    padding: 9px 10px;
}

.rich-text-select {
    width: auto;
    min-width: 86px;
    padding: 8px 10px;
}

.rich-text-btn:hover,
.rich-text-select:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.rich-text-btn.is-active {
    background: #0b63ce;
    border-color: #0b63ce;
    color: #fff;
}

.rich-text-input {
    min-height: 180px;
    padding: 14px;
    font-size: 14px;
    line-height: 1.6;
    color: #1f2937;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
}

.rich-text-input-compact {
    min-height: 140px;
}

.rich-text-input:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
}

.rich-text-input p,
.rich-text-input div {
    margin: 0 0 12px;
}

.rich-text-input p:last-child,
.rich-text-input div:last-child {
    margin-bottom: 0;
}

.rich-text-input ul,
.rich-text-input ol {
    margin: 0 0 12px 22px;
    padding: 0;
}

.rich-text-input a {
    color: #0b63ce;
}

.rich-text-source {
    display: none;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.form-actions button {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.form-actions button.primary {
    background: #0066cc;
    color: white;
    margin: 0;
}

.form-actions button.primary:hover {
    background: #0052a3;
}

.form-actions button.secondary {
    background: #f5f5f5;
    color: #222;
    border: 1px solid #ddd;
    margin: 0;
}

.form-actions button.secondary:hover {
    background: #ebebeb;
}

.link-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.link-input-group input {
    flex: 1;
}

.link-input-group button {
    padding: 8px 12px;
    font-size: 13px;
    margin: 0;
}

#marketingLinkPasteArea {
    resize: vertical;
}

.email-input-group {
    margin-bottom: 12px;
}

/* ===== EDIT PAYMENT BUTTON STYLES ===== */
.edit-payment-button {
    background-color: #0066cc !important;
    color: white !important;
    padding: 12px 20px !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3) !important;
    transition: background-color 0.2s !important;
    margin: 0 !important;
    height: 44px !important;
    min-height: 44px !important;
    line-height: 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
}

.edit-payment-button:hover {
    background-color: #0052a3 !important;
}

.edit-payment-button:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 102, 204, 0.3) !important;
}

.edit-payment-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 992px) {
    .schedule-marketing-layout {
        flex-direction: column;
    }

    .schedule-marketing-side {
        position: static;
        width: 100%;
        margin-top: 20px;
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }
}

@media (max-width: 768px) {
    .schedule-email-open-link {
        width: 100%;
    }

    .schedule-fields-row {
        grid-template-columns: 1fr;
    }

    .rich-text-toolbar {
        gap: 6px;
        padding: 8px;
    }

    .rich-text-select {
        min-width: 74px;
        font-size: 11px;
        padding: 8px;
    }

    .rich-text-btn {
        min-width: 38px;
        padding: 8px;
        font-size: 11px;
    }

    .rich-text-input {
        min-height: 160px;
        padding: 12px;
    }

    .rich-text-input-compact {
        min-height: 120px;
    }
}

/* ===== SCHEDULE EMAIL CAMPAIGN STYLES ===== */

.marketing-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.marketing-title-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.marketing-icon-circle {
    width: 48px;
    height: 48px;
    background: #0066cc;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.marketing-title {
    margin: 0 !important;
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.marketing-subtitle {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #777;
}

.marketing-stats-grid {
    display: flex;
    gap: 15px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #eef2f7;
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 150px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.stat-icon {
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
}

.stat-icon.sent { color: #0066cc; }
.stat-icon.opened { color: #27ae60; }
.stat-icon.clicked { color: #e74c3c; }
.stat-icon.replied { color: #0066cc; }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 19px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.1;
}

.stat-label {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.form-section {
    margin-bottom: 16px;
}

.form-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: bold;
    color: #333;
}

.form-section small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #666;
}

.form-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.form-actions button {
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.form-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.form-actions button:active {
    transform: translateY(0);
}

.primary {
    background-color: #0066cc;
    color: white;
}

.primary:hover {
    background-color: #0052a3;
}

.secondary {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ccc;
}

.secondary:hover {
    background-color: #e8e8e8;
}

@media (max-width: 768px) {
    .form-actions {
        grid-template-columns: 1fr;
    }
}
