/* Mobile App Companion Frontend Styles */

/* Base styles that adapt to theme */
.mac-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Form styling that inherits from theme */
.mac-form {
    background: inherit;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.mac-form-group {
    margin-bottom: 20px;
}

.mac-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: inherit;
}

.mac-form-group input,
.mac-form-group select,
.mac-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: #fff;
    color: inherit;
}

.mac-form-group input:focus,
.mac-form-group select:focus,
.mac-form-group textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

/* Button styling that adapts to theme colors */
.mac-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.mac-btn:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

.mac-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.mac-btn-secondary {
    background: #666;
}

.mac-btn-secondary:hover {
    background: #444;
}

.mac-btn-danger {
    background: #dc3545;
}

.mac-btn-danger:hover {
    background: #c82333;
}

/* Alert messages */
.mac-alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.mac-alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.mac-alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.mac-alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.mac-alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Profile section */
.mac-profile-section {
    background: inherit;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mac-profile-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: inherit;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.mac-profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 15px;
    border: 3px solid #0073aa;
}

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

.mac-profile-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.mac-profile-field:last-child {
    border-bottom: none;
}

.mac-profile-field label {
    font-weight: bold;
    color: #666;
}

.mac-profile-field span {
    color: inherit;
}

/* Subscription section */
.mac-subscription-card {
    background: inherit;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mac-subscription-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.mac-subscription-card.active {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.05);
}

.mac-subscription-card.recommended {
    border-color: #0073aa;
    background: rgba(0, 115, 170, 0.05);
}

.mac-subscription-card .plan-name {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    color: inherit;
}

.mac-subscription-card .plan-price {
    font-size: 36px;
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 5px;
}

.mac-subscription-card .plan-interval {
    color: #666;
    margin-bottom: 20px;
}

.mac-subscription-card .plan-features {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.mac-subscription-card .plan-features li {
    padding: 5px 0;
    color: inherit;
}

.mac-subscription-card .plan-features li:before {
    content: "✓";
    color: #28a745;
    font-weight: bold;
    margin-right: 10px;
}

.mac-subscription-status {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

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

.mac-subscription-status.canceled {
    background: #f8d7da;
    color: #721c24;
}

.mac-subscription-status.past_due {
    background: #fff3cd;
    color: #856404;
}

/* Loading states */
.mac-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: mac-spin 1s linear infinite;
    margin-right: 10px;
}

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

.mac-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Responsive design */
@media (max-width: 768px) {
    .mac-container {
        padding: 10px;
    }
    
    .mac-form {
        padding: 20px;
        margin: 10px 0;
    }
    
    .mac-profile-info {
        grid-template-columns: 1fr;
    }
    
    .mac-profile-field {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .mac-subscription-card {
        padding: 20px;
        margin-bottom: 15px;
    }
    
    .mac-subscription-card .plan-price {
        font-size: 28px;
    }
}

/* Theme-specific overrides */
.theme-twentytwentyfive .mac-form,
.theme-twentytwentyfour .mac-form {
    background: var(--wp--preset--color--base, #fff);
    color: var(--wp--preset--color--contrast, #000);
}

.theme-astra .mac-btn {
    background: var(--ast-global-color-0, #0073aa);
}

.theme-generatepress .mac-form {
    background: var(--form-bg-color, #fff);
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .mac-form {
        background: #2c2c2c;
        color: #fff;
    }
    
    .mac-form-group input,
    .mac-form-group select,
    .mac-form-group textarea {
        background: #404040;
        color: #fff;
        border-color: #555;
    }
    
    .mac-profile-section {
        background: #2c2c2c;
        color: #fff;
    }
    
    .mac-subscription-card {
        background: #2c2c2c;
        color: #fff;
        border-color: #555;
    }
    
    .mac-profile-field {
        border-bottom-color: #555;
    }
}

/* Accessibility improvements */
.mac-form-group input:focus,
.mac-form-group select:focus,
.mac-form-group textarea:focus,
.mac-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.mac-btn:focus {
    outline-color: #fff;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* Custom checkbox and radio styles */
.mac-checkbox,
.mac-radio {
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    margin-bottom: 10px;
    color: inherit;
}

.mac-checkbox input,
.mac-radio input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.mac-checkbox .checkmark,
.mac-radio .checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 3px;
}

.mac-radio .checkmark {
    border-radius: 50%;
}

.mac-checkbox:hover input ~ .checkmark,
.mac-radio:hover input ~ .checkmark {
    border-color: #0073aa;
}

.mac-checkbox input:checked ~ .checkmark,
.mac-radio input:checked ~ .checkmark {
    background-color: #0073aa;
    border-color: #0073aa;
}

.mac-checkbox .checkmark:after,
.mac-radio .checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.mac-checkbox input:checked ~ .checkmark:after,
.mac-radio input:checked ~ .checkmark:after {
    display: block;
}

.mac-checkbox .checkmark:after {
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mac-radio .checkmark:after {
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}
