/**
 * All of the CSS for your public-facing functionality should be
 * included in this file.
 */

/* ========================================
   SweetAlert2 Modal Fixes
   ======================================== */

/* Ensure SweetAlert2 appears above everything */
.swal2-container {
	z-index: 999999 !important;
	position: fixed !important;
}

/* Fix any potential positioning issues */
.swal2-popup {
	position: relative !important;
	max-width: 32em !important;
	margin: auto !important;
}

/* Ensure backdrop covers full screen */
.swal2-backdrop-show {
	background: rgba(0, 0, 0, 0.4) !important;
}

/* Fix button styling to match site theme */
.swal2-confirm {
	background-color: #0066cc !important;
	border-color: #0066cc !important;
}

.swal2-confirm:hover {
	background-color: #0052a3 !important;
	border-color: #0052a3 !important;
}

/* ========================================
   My Account Document Licenses Styling
   ======================================== */

/* Main wrapper */
.mmcd-document-licenses {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.licenses-header h3 {
    margin: 0 0 8px 0;
    color: #212529;
    font-size: 24px;
    font-weight: 600;
}

.licenses-header .description {
    color: #6c757d;
    font-size: 16px;
    margin-bottom: 24px;
}

/* Filter Controls */
.licenses-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-weight: 600;
    font-size: 14px;
    color: #495057;
}

.licenses-filters select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    color: #495057;
    min-width: 120px;
}

.licenses-filters select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.25);
}

/* Table Styling */
.licenses-table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.licenses-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.licenses-table th {
    background: #f8f9fa;
    font-weight: 600;
    padding: 16px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    color: #495057;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.licenses-table td {
    padding: 16px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

.licenses-table tbody tr:last-child td {
    border-bottom: none;
}

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

/* Document Info Styling */
.document-info strong {
    font-size: 16px;
    color: #212529;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.document-meta {
    margin-top: 4px;
}

.text-muted {
    color: #6c757d;
    font-size: 13px;
}

.document-meta a {
    color: #0066cc;
    text-decoration: none;
}

.document-meta a:hover {
    text-decoration: underline;
}

/* Status Badges */
.license-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.license-status.active {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.license-status.expired {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.license-status.pending_renewal {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Type Badges */
.type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.type-badge.type-desktop {
    background: #e8f5e8;
    color: #2e7d32;
    border-color: #c8e6c9;
}

.type-badge.type-mobile {
    background: #fff3e0;
    color: #f57c00;
    border-color: #ffcc02;
}

.type-badge.type-web_viewer {
    background: #f3e5f5;
    color: #7b1fa2;
    border-color: #ce93d8;
}

/* Action Buttons */
.license-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.woocommerce-MyAccount-content .button,
.woocommerce-MyAccount-content .btn,
.licenses-table .button {
    background: #0066cc;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 2px;
    min-height: 32px;
}

.woocommerce-MyAccount-content .button:hover,
.licenses-table .button:hover {
    background: #0052a3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    color: white;
    text-decoration: none;
}

.woocommerce-MyAccount-content .button:active,
.licenses-table .button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Secondary Buttons */
.woocommerce-MyAccount-content .button.secondary,
.licenses-table .button.secondary {
    background: #6c757d;
    color: white;
}

.woocommerce-MyAccount-content .button.secondary:hover,
.licenses-table .button.secondary:hover {
    background: #545b62;
    color: white;
}

/* Small Buttons */
.button.button-small {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 28px;
}

/* Assignment Info */
.assignment-info {
    font-size: 14px;
    color: #495057;
}

.assignment-progress {
    font-weight: 600;
    color: #0066cc;
}

/* Expiry Info */
.expiry-info {
    font-size: 14px;
    color: #495057;
}

.expiry-perpetual {
    color: #28a745;
    font-weight: 600;
}

.expiry-date {
    color: #495057;
}

/* Auto-renewal badge */
.renewal-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #d1ecf1;
    color: #0c5460;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .licenses-filters {
        flex-direction: column;
        gap: 12px;
    }
    
    .licenses-table-container {
        overflow-x: auto;
    }
    
    .licenses-table {
        min-width: 600px;
    }
    
    .license-actions {
        flex-direction: column;
    }
    
    .license-actions .button {
        width: 100%;
        justify-content: center;
    }
}

/* WordPress Dashicons Support */
.button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 4px;
}

/* Empty State */
.woocommerce-message.woocommerce-message--info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
}

/* Error State */
.woocommerce-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.woocommerce-error p {
    margin: 0;
    color: #721c24;
}

/* ========================================
   My Account Horizontal Tabs Layout
   ======================================== */

/* My Account Header */
.woocommerce-account .site-header-wrapper,
.woocommerce-MyAccount-header {
    background: var(--myaccount-header-bg, #0066cc);
    padding: 40px 0;
    margin: -30px -30px 0 -30px; /* Extend to edges */
    color: white;
    position: relative;
}

.woocommerce-MyAccount-header h1 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 600;
}

.woocommerce-MyAccount-header .greeting {
    font-size: 18px;
    opacity: 0.95;
    line-height: 1.4;
}

.woocommerce-MyAccount-header .avatar {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.3);
}

/* Override WooCommerce Default Layout */
.woocommerce .woocommerce-MyAccount-navigation,
.woocommerce-account .woocommerce-MyAccount-navigation,
.woocommerce-MyAccount-navigation {
    float: none !important;
    width: 100% !important;
    background: rgba(255,255,255,0.15);
    margin: 0 -30px;
    padding: 0;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.woocommerce .woocommerce-MyAccount-content,
.woocommerce-account .woocommerce-MyAccount-content,
.woocommerce-MyAccount-content {
    float: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    clear: both;
}

.woocommerce-MyAccount-navigation ul {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.woocommerce-MyAccount-navigation li {
    flex: 1;
    margin: 0;
}

.woocommerce-MyAccount-navigation a {
    display: block;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    text-align: center;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    opacity: 0.8;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
}

.woocommerce-MyAccount-navigation li.is-active a,
.woocommerce-MyAccount-navigation a:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
    border-bottom-color: white;
    color: white;
    text-decoration: none;
}

.woocommerce-MyAccount-navigation li.is-active a {
    background: rgba(255,255,255,0.2);
    font-weight: 600;
}

/* Content Area */
.woocommerce-MyAccount-content {
    padding: 30px 0;
    background: white;
}

/* Hide tabs based on admin settings */
.hide-downloads .woocommerce-MyAccount-navigation-link--downloads,
.hide-addresses .woocommerce-MyAccount-navigation-link--edit-address,
.hide-account-details .woocommerce-MyAccount-navigation-link--edit-account,
.hide-payment-methods .woocommerce-MyAccount-navigation-link--payment-methods {
    display: none;
}

/* Custom body class styling */
.mmcd-custom-myaccount .woocommerce-MyAccount-content {
    background: #f8f9fa;
    min-height: 400px;
}

.mmcd-custom-myaccount .woocommerce {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 20px;
}

/* Force container layout */
.mmcd-custom-myaccount .woocommerce-account {
    display: block !important;
}

.mmcd-custom-myaccount .woocommerce-account::after {
    content: "";
    display: table;
    clear: both;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .woocommerce-MyAccount-header {
        padding: 30px 20px;
        margin: -20px -20px 0 -20px;
    }
    
    .woocommerce-MyAccount-header h1 {
        font-size: 24px;
    }
    
    .woocommerce-MyAccount-header .greeting {
        font-size: 16px;
    }
    
    .woocommerce-MyAccount-navigation {
        margin: 0 -20px;
    }
    
    .woocommerce-MyAccount-navigation ul {
        flex-wrap: nowrap;
        overflow-x: scroll;
        padding: 0 10px;
    }
    
    .woocommerce-MyAccount-navigation li {
        flex: 0 0 auto;
        min-width: 100px;
    }
    
    .woocommerce-MyAccount-navigation a {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .woocommerce-MyAccount-header .avatar {
        width: 60px;
        height: 60px;
        right: 20px;
    }
    
    .woocommerce-MyAccount-content {
        padding: 20px 0;
    }
}

/* Container styling */
.woocommerce-MyAccount-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px;
    position: relative;
}

@media (max-width: 768px) {
    .woocommerce-MyAccount-header .container {
        padding: 0 20px;
    }
}

/* ========================================
   License Agreement Checkout Styling
   ======================================== */

/* Error highlighting for license agreement checkbox */
.wc-block-components-checkbox.error-highlight {
    animation: errorPulse 1s ease-in-out 3;
    border-radius: 4px;
    padding: 8px;
    background: rgba(220, 53, 69, 0.05);
    border: 2px solid #dc3545;
}

@keyframes errorPulse {
    0% { 
        border-color: #dc3545;
        background: rgba(220, 53, 69, 0.05);
    }
    50% { 
        border-color: #dc3545;
        background: rgba(220, 53, 69, 0.15);
    }
    100% { 
        border-color: #dc3545;
        background: rgba(220, 53, 69, 0.05);
    }
}

/* License agreement section styling */
.wc-block-checkout__license-agreement {
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #ffffff;
    padding: 1.5rem;
}

.wc-block-checkout__license-agreement .wc-block-components-checkout-step__title {
    color: #212529;
    font-size: 1.2em;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

/* Make the checkbox label more prominent */
.wc-block-checkout__license-agreement .wc-block-components-checkbox__label {
    font-weight: 500;
    color: #212529;
    line-height: 1.4;
}

/* Style the required asterisk */
.wc-block-checkout__license-agreement .wc-block-components-checkbox__label span[style*="color: #cc1818"] {
    color: #dc3545 !important;
    font-weight: 700;
    font-size: 1.2em;
}

/* Error message specific styling */
.mmcd-license-error {
    border: 1px solid #dc3545 !important;
    border-radius: 6px !important;
    background: #f8d7da !important;
    color: #721c24 !important;
}

.mmcd-license-error svg {
    fill: #721c24 !important;
}

.mmcd-license-error .wc-block-components-notice-banner__content {
    color: #721c24 !important;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .wc-block-checkout__license-agreement {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .wc-block-checkout__license-agreement .wc-block-components-checkout-step__title {
        font-size: 1.1em;
    }
}

/* ========================================
   Document Licenses Page Styling
   ======================================== */

.mmcd-document-licenses {
    max-width: 1200px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.licenses-header {
    margin-bottom: 2rem;
}

.licenses-header h3 {
    color: #212529;
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.licenses-header .description {
    color: #6c757d;
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* Filters */
.licenses-filters {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-group label {
    font-weight: 600;
    white-space: nowrap;
    color: #495057;
    font-size: 0.9rem;
}

.filter-group select {
    min-width: 150px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    color: #495057;
}

.filter-group select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.25);
}

/* Table */
.licenses-table-container {
    overflow-x: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: white;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.licenses-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.licenses-table th,
.licenses-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

.licenses-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.licenses-table tbody tr:last-child td {
    border-bottom: none;
}

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

/* Document Info */
.document-info strong {
    color: #0066cc;
    font-size: 1rem;
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

.document-meta {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.document-meta a {
    color: #6c757d;
    text-decoration: none;
}

.document-meta a:hover {
    color: #0066cc;
    text-decoration: underline;
}

/* Type and Status Badges */
.type-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.type-desktop {
    background: #e3f2fd;
    color: #1565c0;
    border-color: #bbdefb;
}

.type-mobile {
    background: #f3e5f5;
    color: #7b1fa2;
    border-color: #ce93d8;
}

.type-web_viewer {
    background: #e8f5e8;
    color: #2e7d32;
    border-color: #c8e6c9;
}

.type-enterprise {
    background: #fff3e0;
    color: #ef6c00;
    border-color: #ffcc02;
}

.type-print {
    background: #f5f5f5;
    color: #424242;
    border-color: #e0e0e0;
}

.license-status {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.license-status.active {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.license-status.expired {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.license-status.pending_renewal {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

/* Auto-renewal */
.auto-renewal {
    margin-top: 0.5rem;
}

.renewal-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #d1ecf1;
    color: #0c5460;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* Expiry Info */
.expiry-info.expired {
    color: #dc3545;
    font-weight: 600;
}

.expiry-info.expiring-soon {
    color: #fd7e14;
    font-weight: 600;
}

.expiry-warning {
    font-size: 0.75rem;
    color: #fd7e14;
    margin-top: 0.25rem;
    font-weight: 500;
}

.perpetual {
    color: #28a745;
    font-weight: 600;
}

/* Assignment Info */
.assignment-count {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

.assignment-list {
    font-size: 0.8rem;
}

.assignee {
    margin-bottom: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.assignee-name {
    font-weight: 600;
    display: block;
    color: #495057;
}

.assignee-email {
    color: #6c757d;
    font-size: 0.85rem;
}

.more-assignments {
    color: #6c757d;
    font-style: italic;
    margin-top: 0.25rem;
    font-size: 0.8rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.button-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    min-width: 90px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.button-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.button-small .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 0.25rem;
}

/* Modal Styles */
.mmcd-modal {
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}

.mmcd-modal-content {
    position: relative;
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

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

.mmcd-modal-header h4 {
    margin: 0;
    color: #495057;
    font-size: 1.25rem;
    font-weight: 600;
}

.mmcd-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.mmcd-modal-close:hover {
    color: #495057;
    background: #e9ecef;
}

.mmcd-modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.assignment-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #0066cc;
}

.assignment-info p {
    margin: 0.5rem 0;
    color: #495057;
}

.field-group {
    margin-bottom: 1rem;
}

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

.field-group input,
.field-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.field-group input:focus,
.field-group textarea:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.25);
}

.field-note {
    color: #6c757d;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .licenses-filters {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .licenses-table th,
    .licenses-table td {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .mmcd-modal-content {
        margin: 10% auto;
        max-width: 95%;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .document-info strong {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .licenses-table-container {
        overflow-x: scroll;
    }
    
    .licenses-table {
        min-width: 600px;
    }
    
    .licenses-table th,
    .licenses-table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
}