/* WooCommerce Shopify Theme License System - Frontend Styles */

.woocommerce-account-licenses {
    margin-bottom: 2em;
}

.licenses-list {
    margin-top: 1.5em;
}

.license-item {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 4px;
    margin-bottom: 1.5em;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.license-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e2e4e7;
    padding: 1em 1.5em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5em;
}

.license-header h3 {
    margin: 0;
    font-size: 1.2em;
    color: #333;
}

.license-header .order-number {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.license-header .order-date {
    font-size: 0.85em;
    color: #999;
}

.license-content {
    padding: 1.5em;
}

.license-details {
    background: #f9f9f9;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 1.5em;
}

.license-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1em;
}

.license-field {
    margin-bottom: 1em;
}

.license-field:last-child {
    margin-bottom: 0;
}

.license-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5em;
    color: #333;
    font-size: 0.9em;
}

.license-field span,
.license-field a {
    color: #666;
    font-size: 0.95em;
}

.license-key-display {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
}

.license-key {
    background: #f8f9fa;
    color: #495057;
    padding: 0.5em 0.75em;
    border: 1px solid #e9ecef;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85em;
    letter-spacing: 0.5px;
    word-break: break-all;
    flex: 1;
    min-width: 200px;
}

.copy-license-key {
    background: #0073aa;
    color: white;
    border: none;
    padding: 0.5em 1em;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.2s;
}

.copy-license-key:hover {
    background: #005a87;
}

.copy-license-key.copied {
    background: #46b450;
}

.status {
    padding: 0.25em 0.75em;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

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

/* Ensure status badges are always visible */
.license-status .status-badge,
.license-status span[class*="status-"] {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.generate-license-section {
    text-align: center;
    padding: 2em 1em;
}

.generate-license-section p {
    margin-bottom: 1.5em;
    color: #666;
    font-size: 1.05em;
}

.show-license-form {
    background: #0073aa;
    color: white;
    border: none;
    padding: 0.75em 2em;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s;
}

.show-license-form:hover {
    background: #005a87;
}

.license-generation-form {
    max-width: 600px;
    margin: 2em auto 0;
    padding: 2em;
    background: #f9f9f9;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.generate-license-form .form-row {
    margin-bottom: 1.5em;
}

.generate-license-form .form-row:last-child {
    margin-bottom: 0;
}

.generate-license-form label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #333;
}

.generate-license-form .required {
    color: #e74c3c;
}

.generate-license-form input[type="text"],
.generate-license-form input[type="email"],
.generate-license-form input[type="url"] {
    width: 100%;
    padding: 0.75em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.2s;
}

.generate-license-form input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.form-actions {
    display: flex;
    gap: 1em;
    justify-content: center;
    margin-top: 2em;
}

.button {
    padding: 0.75em 1.5em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.2s;
}

.button-primary {
    background: #0073aa;
    color: white;
}

.button-primary:hover {
    background: #005a87;
    color: white;
}

.cancel-license-form {
    background: #666;
    color: white;
}

.cancel-license-form:hover {
    background: #555;
}

/* Loading states */
.license-item.loading {
    opacity: 0.7;
}

.license-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Messages */
.wcstl-message {
    padding: 1em;
    border-radius: 4px;
    margin: 1em 0;
}

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

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

.wcstl-message.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Streamlined License Management Styles */

/* License Generation Section */
.license-generation-section {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
}

.license-generation-section h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

#license-generation-form .form-row {
    margin-bottom: 20px;
}

#license-generation-form .form-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #34495e;
}

#license-generation-form input,
#license-generation-form select {
    width: 100%;
    max-width: 400px;
    padding: 12px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

#license-generation-form input:focus,
#license-generation-form select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#license-generation-form .form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

#generate-license-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#generate-license-btn:hover {
    background: #2980b9;
}

.license-generation-spinner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #3498db;
    font-weight: 600;
}

/* Licenses Table Section */
.licenses-table-section {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 25px;
}

.licenses-table-section h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.licenses-table {
    width: 100%;
    min-width: 800px; /* Minimum width to maintain readability */
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    table-layout: fixed; /* Fixed table layout for better column control */
}

.licenses-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on mobile */
}

.licenses-table th {
    background: #f8f9fa;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
}

/* Column width control for better layout */
.licenses-table th:nth-child(1) { width: 10rem; } /* Product Name */
.licenses-table th:nth-child(2) { width: 10rem; } /* License Key */
.licenses-table th:nth-child(3) { width: 10rem; } /* Status */
.licenses-table th:nth-child(4) { width: 10rem; } /* Website Domain */
.licenses-table th:nth-child(5) { width: 10rem; } /* Shopify Domain */
.licenses-table th:nth-child(6) { width: 10rem; } /* Activation Date */
.licenses-table th:nth-child(7) { width: 5rem; }  /* Actions */

.licenses-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 0; /* Enable text wrapping in fixed table layout */
}

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

.licenses-table .license-key-display {
    background: #f8f9fa;
    color: #495057;
    padding: 6px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    word-break: break-all;
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e0e0e0;
    line-height: 1.3;
}

.licenses-table .copy-license-key {
    background: #007cba;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 11px;
    padding: 4px 8px;
    margin-top: 6px;
    border-radius: 3px;
    display: inline-block;
    text-decoration: none;
    transition: background-color 0.2s;
}

.licenses-table .copy-license-key:hover {
    background: #005a87;
    color: white;
}

/* Specific column content styling */
.licenses-table .product-name {
    font-weight: 600;
}

.licenses-table .product-name small {
    color: #6c757d;
    font-weight: 400;
    font-size: 12px;
}

.licenses-table .website-domain a,
.licenses-table .shopify-domain code {
    word-break: break-all;
    font-size: 12px;
}

.licenses-table .activation-date {
    white-space: nowrap;
    font-size: 12px;
}

.licenses-table .license-actions {
    font-size: 11px;
    line-height: 1.3;
}

/* Enhanced Status badges - High specificity to override other styles */
.licenses-table .status-badge,
.woocommerce-account-licenses .status-badge {
    display: inline-block !important;
    padding: 6px 10px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 70px;
    text-align: center;
}

.licenses-table .status-badge.status-pending,
.woocommerce-account-licenses .status-badge.status-pending {
    background: #fff3cd !important;
    color: #856404 !important;
    border: 1px solid #ffeaa7;
}

.licenses-table .status-badge.status-active,
.woocommerce-account-licenses .status-badge.status-active {
    background: #d1f2eb !important;
    color: #0c5460 !important;
    border: 1px solid #7dcea0;
}

.licenses-table .status-badge.status-inactive,
.woocommerce-account-licenses .status-badge.status-inactive {
    background: #f8d7da !important;
    color: #721c24 !important;
    border: 1px solid #f5c6cb;
}

.licenses-table .status-badge.status-revoked,
.woocommerce-account-licenses .status-badge.status-revoked {
    background: #fadbd8 !important;
    color: #a94442 !important;
    border: 1px solid #e8c3c8;
}

.licenses-table .status-badge.status-expired,
.woocommerce-account-licenses .status-badge.status-expired {
    background: #e2e3e5 !important;
    color: #383d41 !important;
    border: 1px solid #d6d8db;
}

.licenses-summary {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.licenses-summary ul {
    margin: 10px 0 0 20px;
    list-style-type: disc;
}

.licenses-summary li {
    margin-bottom: 5px;
    font-size: 14px;
}

.product-name strong {
    color: #2c3e50;
}

.product-name small {
    color: #7f8c8d;
}

.revoked-reason {
    color: #e74c3c;
    font-style: italic;
}

.pending-info {
    color: #f39c12;
    font-style: italic;
}

.active-info {
    color: #27ae60;
    font-weight: 600;
}

.revoked-info {
    color: #e74c3c;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Legacy components (backward compatibility) */
    .license-header {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .license-info {
        grid-template-columns: 1fr;
    }
    
    .license-key-display {
        flex-direction: column;
        align-items: stretch;
    }
    
    .license-key {
        min-width: auto;
        margin-bottom: 0.5em;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .license-content {
        padding: 1em;
    }
    
    .license-generation-form {
        margin: 1em auto 0;
        padding: 1.5em;
    }
    
    /* Streamlined interface responsive design */
    .license-generation-section,
    .licenses-table-section {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .license-generation-section h3,
    .licenses-table-section h3 {
        font-size: 1.1em;
        margin-bottom: 15px;
    }
    
    #license-generation-form input,
    #license-generation-form select {
        max-width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    #generate-license-btn {
        width: 100%;
        padding: 16px 20px;
        font-size: 16px;
    }
    
    /* Mobile-first table design */
    .licenses-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .licenses-table thead {
        display: none; /* Hide headers on mobile */
    }
    
    .licenses-table,
    .licenses-table tbody,
    .licenses-table tr,
    .licenses-table td {
        display: block;
    }
    
    .licenses-table tr {
        border: 1px solid #dee2e6;
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 15px;
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .licenses-table td {
        border: none;
        padding: 8px 0;
        text-align: left;
        position: relative;
        padding-left: 40%;
        word-break: break-word;
        white-space: normal;
    }
    
    /* Add labels for mobile */
    .licenses-table td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 0;
        width: 35%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: #495057;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .licenses-table .license-key-display {
        max-width: 100%;
        font-size: 11px;
        word-break: break-all;
        background: #f8f9fa;
        border: 1px solid #e9ecef;
    }
    
    .licenses-table .copy-license-key {
        display: block;
        text-align: center;
        margin-top: 8px;
        padding: 8px;
        background: #007cba;
        color: white;
        border-radius: 4px;
        text-decoration: none;
        font-size: 12px;
        font-weight: 600;
    }
    
    .licenses-table .status-badge {
        display: inline-block;
        padding: 6px 12px;
        margin-top: 5px;
        font-size: 10px;
        text-align: center;
        min-width: 80px;
    }
    
    /* Form responsiveness */
    #license-generation-form .form-row {
        margin-bottom: 20px;
    }
    
    #license-generation-form .form-row label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    #license-generation-form .form-text {
        font-size: 11px;
        line-height: 1.4;
    }
    
    /* Message responsiveness */
    .wcstl-message {
        padding: 12px;
        font-size: 14px;
        line-height: 1.4;
    }
    
    .license-generation-spinner {
        font-size: 14px;
        gap: 8px;
    }
    
    .licenses-summary {
        padding: 12px;
        font-size: 13px;
    }
    
    .licenses-summary ul {
        margin: 8px 0 0 15px;
    }
    
    .licenses-summary li {
        margin-bottom: 3px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    /* Extra small devices */
    .license-generation-section,
    .licenses-table-section {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .license-generation-section h3,
    .licenses-table-section h3 {
        font-size: 1em;
        padding-bottom: 8px;
        margin-bottom: 12px;
    }
    
    #license-generation-form input,
    #license-generation-form select {
        padding: 14px;
        font-size: 16px;
    }
    
    #generate-license-btn {
        padding: 18px 20px;
        font-size: 16px;
        font-weight: 700;
    }
    
    .licenses-table tr {
        margin-bottom: 12px;
        padding: 12px;
    }
    
    .licenses-table td {
        padding: 6px 0;
        padding-left: 35%;
        font-size: 13px;
    }
    
    .licenses-table td:before {
        width: 30%;
        font-size: 11px;
    }
    
    .licenses-table .license-key-display {
        font-size: 10px;
        padding: 6px 8px;
    }
    
    .wcstl-message {
        padding: 10px;
        font-size: 13px;
    }
}