/* Nextcloud WooCommerce Integration - Frontend Styles */

/* Accounts Wrapper */
.ncwi-accounts-wrapper {
    margin: 20px 0;
}

.ncwi-accounts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.ncwi-accounts-header h3 {
    margin: 0;
}

/* Buttons */
.ncwi-add-account-btn {
    background: #0073aa !important;
    color: white !important;
    border: none !important;
}

.ncwi-add-account-btn:hover {
    background: #005a87 !important;
}

/* Status badges */
.ncwi-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.ncwi-status-active {
    background: #7ad03a;
    color: white;
}

.ncwi-status-pending_verification {
    background: #ffba00;
    color: white;
}

.ncwi-status-suspended {
    background: #dd3333;
    color: white;
}

.ncwi-status-unlinked {
    background: #999;
    color: white;
}

/* Quota info */
.ncwi-quota-info {
    font-size: 14px;
}

.ncwi-quota-used {
    font-weight: bold;
}

/* Subscription list */
.ncwi-subscription-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ncwi-subscription-list li {
    margin: 2px 0;
}

/* Actions */
.ncwi-actions button {
    margin: 2px 0;
}
/* Loading state for buttons */
.ncwi-manage-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.ncwi-manage-btn.loading::after {
    content: "";
    position: absolute;
    right: -25px;
    top: 50%;
    margin-top: -8px;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: ncwi-spin 1s linear infinite;
}

/* Modal styles */
.ncwi-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.ncwi-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 5px;
    position: relative;
}

.ncwi-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 10px;
}

.ncwi-modal-close:hover,
.ncwi-modal-close:focus {
    color: #000;
}

/* Tabs */
.ncwi-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.ncwi-tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.ncwi-tab-btn:hover {
    color: #333;
}

.ncwi-tab-btn.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
}

/* Forms */
.ncwi-tab-content form p {
    margin-bottom: 15px;
}

.ncwi-tab-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.ncwi-tab-content input[type="text"],
.ncwi-tab-content input[type="email"],
.ncwi-tab-content input[type="password"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.ncwi-tab-content .description {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Account details */
.ncwi-account-details h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.ncwi-account-details h4:first-child {
    margin-top: 0;
}

.ncwi-info-table {
    width: 100%;
    margin-bottom: 20px;
}

.ncwi-info-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.ncwi-info-table td:first-child {
    width: 40%;
    color: #666;
}

/* Subscriptions table */
.ncwi-subscriptions-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.ncwi-subscriptions-table th,
.ncwi-subscriptions-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.ncwi-subscriptions-table th {
    background: #f5f5f5;
    font-weight: 600;
}

/* Account actions */
.ncwi-account-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.ncwi-account-actions button {
    margin-right: 10px;
}

/* Select dropdown */
#ncwi-link-subscription-select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin-right: 10px;
}

/* Error messages */
.ncwi-error {
    color: #dd3333;
    font-weight: 600;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .ncwi-accounts-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ncwi-add-account-btn {
        margin-top: 10px;
    }
    
    .woocommerce-table--ncwi-accounts {
        font-size: 14px;
    }
    
    .ncwi-modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .ncwi-tabs {
        flex-direction: column;
    }
    
    .ncwi-tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
        margin-bottom: 0;
    }
    
    .ncwi-tab-btn.active {
        border-left-color: #0073aa;
        border-bottom-color: transparent;
    }
}

/* Loading state */
.ncwi-loading {
    opacity: 0.6;
    pointer-events: none;
}

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

@keyframes ncwi-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No data */
.ncwi-no-data {
    color: #999;
    font-style: italic;
}

.ncwi-no-subscriptions {
    color: #666;
    font-size: 13px;
}