/**
 * Email Dropdown Component Styles
 */

/* Dropdown Wrapper */
.pzmo-email-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

/* Dropdown Button - Default (Order Preview Style - Blue) */
.pzmo-email-dropdown-btn,
.pzmo-email-dropdown-btn-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    background: #1a73e8;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pzmo-email-dropdown-btn:hover,
.pzmo-email-dropdown-btn-trigger:hover {
    background: #1557b0;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Compact button for table cells (Admin Table Style) */
.pzmo-email-dropdown-wrapper[data-context="admin-table"] .pzmo-email-dropdown-btn {
    background: #f5f5f5;
    color: #1f2937;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 20px;
    box-shadow: none;
    border: 1px solid #e5e7eb;
    font-weight: 400;
    gap: 4px;
}

.pzmo-email-dropdown-wrapper[data-context="admin-table"] .pzmo-email-dropdown-btn:hover {
    background: #e5e7eb;
    color: #111827;
    transform: none;
    box-shadow: none;
}

.pzmo-email-dropdown-wrapper[data-context="admin-table"] .pzmo-email-dropdown-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.pzmo-email-dropdown-wrapper[data-context="admin-table"] .pzmo-email-dropdown-btn .dashicons-arrow-down-alt2 {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.pzmo-email-dropdown-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.pzmo-email-dropdown-btn .dashicons-arrow-down-alt2 {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Dropdown Menu */
.pzmo-email-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 5px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 350px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 9999;
}

/* Search Input */
.pzmo-email-dropdown-search {
    padding: 10px;
    border-bottom: 1px solid #dcdcde;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.pzmo-email-search-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    font-size: 13px;
}

.pzmo-email-search-input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Category */
.pzmo-email-category {
    margin: 5px 0;
}

.pzmo-email-category-header {
    padding: 8px 12px;
    background: #f6f7f7;
    font-weight: 600;
    font-size: 12px;
    color: #50575e;
    border-top: 1px solid #dcdcde;
    border-bottom: 1px solid #dcdcde;
    position: sticky;
    top: 51px; /* Below search bar */
    z-index: 1;
}

.pzmo-email-category:first-child .pzmo-email-category-header {
    border-top: none;
}

/* Template Item */
.pzmo-email-template-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.pzmo-email-template-item:hover {
    background: #f0f6fc;
}

.pzmo-email-template-item.hidden {
    display: none;
}

.pzmo-email-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.pzmo-email-label {
    flex: 1;
    font-size: 13px;
    color: #2c3338;
}

/* ============================================
   GMAIL-STYLE EMAIL COMPOSER MODAL
   ============================================ */

.pzmo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pzmo-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.pzmo-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
    width: 90%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: pzmo-modal-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pzmo-modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Gmail-style Header */
.pzmo-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e8eaed;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.pzmo-modal-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #202124;
    letter-spacing: 0.01em;
}

/* Gmail-style Close Button */
.pzmo-modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #5f6368;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.pzmo-modal-close:hover {
    background: #e8eaed;
    color: #202124;
}

.pzmo-modal-close .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Gmail-style Body */
.pzmo-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

/* Gmail-style Form Groups (Minimal underline style) */
.pzmo-form-group {
    margin: 0;
    padding: 16px 24px;
    border-bottom: 1px solid #f1f3f4;
    position: relative;
}

.pzmo-form-group:last-of-type {
    border-bottom: none;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pzmo-form-group label {
    position: absolute;
    top: 16px;
    left: 24px;
    font-size: 12px;
    font-weight: 500;
    color: #5f6368;
    letter-spacing: 0.01em;
    pointer-events: none;
    transition: all 0.2s;
}

/* Gmail-style Inputs (Bottom border only) */
.pzmo-form-group input[type="text"],
.pzmo-form-group input[type="email"],
.pzmo-form-group textarea {
    width: 100%;
    padding: 8px 0;
    border: none;
    border-bottom: 1px solid #e8eaed;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #202124;
    background: transparent;
    outline: none;
    transition: border-color 0.2s;
}

.pzmo-form-group input:focus,
.pzmo-form-group textarea:focus {
    border-bottom-color: #1a73e8;
}

.pzmo-form-group input:focus + label,
.pzmo-form-group textarea:focus + label {
    color: #1a73e8;
}

.pzmo-form-group input[readonly] {
    color: #5f6368;
    cursor: default;
    border-bottom-color: transparent;
}

.pzmo-form-group textarea {
    resize: vertical;
    min-height: 200px;
    padding-top: 12px;
    border-bottom: none;
}

/* Gmail-style Footer */
.pzmo-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid #e8eaed;
    background: #fff;
    border-radius: 0 0 8px 8px;
}

/* Gmail-style Send Button */
.pzmo-modal-footer .button-primary {
    background: #1a73e8;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pzmo-modal-footer .button-primary:hover {
    background: #1765cc;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16), 0 2px 4px rgba(0, 0, 0, 0.28);
}

.pzmo-modal-footer .button-primary:active {
    background: #1557b0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transform: translateY(1px);
}

/* Gmail-style Secondary Button */
.pzmo-modal-footer .button {
    background: transparent;
    color: #5f6368;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.pzmo-modal-footer .button:hover {
    background: #f1f3f4;
}

/* Toast Notification */
.pzmo-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #fff;
    border-left: 4px solid #00a32a;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    padding: 16px 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 500px;
    z-index: 999999;
    animation: pzmo-toast-slide-in 0.3s ease-out;
}

@keyframes pzmo-toast-slide-in {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pzmo-toast.pzmo-toast-error {
    border-left-color: #d63638;
}

.pzmo-toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.pzmo-toast-message {
    flex: 1;
    font-size: 13px;
    color: #2c3338;
}

.pzmo-toast-actions {
    display: flex;
    gap: 8px;
}

.pzmo-toast-undo {
    background: none;
    border: none;
    color: #2271b1;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background 0.15s;
}

.pzmo-toast-undo:hover {
    background: #f0f6fc;
}

.pzmo-toast-close {
    background: none;
    border: none;
    color: #50575e;
    cursor: pointer;
    padding: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background 0.15s;
}

.pzmo-toast-close:hover {
    background: #f0f0f1;
}

.pzmo-toast-close .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Loading State */
.pzmo-email-dropdown-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.pzmo-email-dropdown-btn.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pzmo-spin 0.6s linear infinite;
    margin-left: 8px;
}

@keyframes pzmo-spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 782px) {
    .pzmo-email-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 8px 8px 0 0;
        max-width: none;
        max-height: 80vh;
    }

    .pzmo-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .pzmo-toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
        max-width: none;
    }
}
