/* ===== KING ADDONS AI SETTINGS - MODERN DESIGN ===== */

/* Font Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Global Overrides */
.king-addons-ai-settings {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-right: 10px !important;
    margin-top: 30px !important;
}

/* Header Section */
.king-addons-settings-header {
    background: linear-gradient(135deg, #1a1b1b 0%, #2d2f30 100%);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.king-addons-settings-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(91, 3, 255, 0.1), rgba(76, 175, 80, 0.1));
    opacity: 0.5;
    z-index: 0;
}

.king-addons-settings-header-content {
    display: flex;
    align-items: center;
    gap: 24px;
    position: relative;
    z-index: 1;
}

.king-addons-settings-header-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #5b03ff, #4caf50);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(91, 3, 255, 0.3);
    animation: pulse-glow 2s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
    0% { box-shadow: 0 8px 32px rgba(91, 3, 255, 0.3); }
    100% { box-shadow: 0 12px 48px rgba(91, 3, 255, 0.5); }
}

.king-addons-settings-header-icon img {
    width: 32px;
    height: 32px;
    filter: brightness(0) invert(1);
}

.king-addons-settings-title {
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.king-addons-settings-subtitle {
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    line-height: 1.5;
}

/* Settings Container */
.king-addons-settings-container {
    background: rgba(26, 27, 27, 0.9);
    border-radius: 20px;
    padding: 0;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

/* Form Styling */
.king-addons-settings-form {
    padding: 0;
}

/* Section Headers */
.king-addons-ai-settings h2 {
    background: linear-gradient(135deg, #2d2f30, #1a1b1b);
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    padding: 24px 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: -0.01em;
    position: relative;
}

.king-addons-ai-settings h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #5b03ff, #4caf50);
}

/* Section descriptions (p tags after h2) */
.king-addons-ai-settings h2 + p {
    background: rgba(45, 47, 48, 0.3);
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 14px;
    font-weight: 400;
    margin: 0;
    padding: 16px 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.5;
}

/* Section Content */
.king-addons-ai-settings .form-table {
    background: transparent;
    margin: 0 0 2px 0;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

/* Section spacing */
.king-addons-ai-settings h2:not(:first-child) {
    margin-top: 24px;
}

.king-addons-ai-settings .form-table th,
.king-addons-ai-settings .form-table td {
    padding: 20px 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
}

/* Remove border from last row */
.king-addons-ai-settings .form-table tr:last-child th,
.king-addons-ai-settings .form-table tr:last-child td {
    border-bottom: none;
}

.king-addons-ai-settings .form-table th {
    background: rgba(45, 47, 48, 0.5);
    color: #ffffff;
    font-weight: 500;
    font-size: 14px;
    width: 25%;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.king-addons-ai-settings .form-table td {
    background: rgba(26, 27, 27, 0.3);
    color: #ffffff;
}

/* Input Fields */
.king-addons-ai-settings input[type="text"],
.king-addons-ai-settings input[type="password"],
.king-addons-ai-settings input[type="number"],
.king-addons-ai-settings select,
.king-addons-ai-settings textarea {
    background: rgba(45, 47, 48, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 400;
    padding: 12px 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    font-family: 'Inter', sans-serif;
}

.king-addons-ai-settings input[type="text"]:focus,
.king-addons-ai-settings input[type="password"]:focus,
.king-addons-ai-settings input[type="number"]:focus,
.king-addons-ai-settings textarea:focus {
    border-color: #5b03ff;
    box-shadow: 0 0 0 4px rgba(91, 3, 255, 0.2);
    outline: none;
    background: rgba(45, 47, 48, 1);
}

.king-addons-ai-settings select:focus {
    color: #8ab4f8;
}

.king-addons-ai-settings input[type="text"]::placeholder,
.king-addons-ai-settings input[type="password"]::placeholder,
.king-addons-ai-settings textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Select dropdown arrows */
.king-addons-ai-settings select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23ffffff' fill-opacity='0.6' d='M6 8L0 2h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px 8px;
    padding-right: 48px;
}

.king-addons-ai-settings select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%235b03ff' d='M6 8L0 2h12z'/></svg>");
}

/* Disabled states */
.king-addons-ai-settings input:disabled,
.king-addons-ai-settings select:disabled,
.king-addons-ai-settings textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(45, 47, 48, 0.3) !important;
}

.king-addons-ai-settings input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Checkboxes */
.king-addons-ai-settings input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    background: rgba(45, 47, 48, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 12px;
}

.king-addons-ai-settings input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #5b03ff, #4caf50);
    border-color: #5b03ff;
}

.king-addons-ai-settings input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Labels */
.king-addons-ai-settings label {
    color: #ffffff;
    font-weight: 500;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: color 0.3s ease;
}

.king-addons-ai-settings label:hover {
    color: #8ab4f8;
}

/* Description Text */
.king-addons-ai-settings .description {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    margin-top: 8px;
    padding: 12px 16px;
    background: rgba(45, 47, 48, 0.3);
    border-radius: 8px;
    border-left: 3px solid rgba(91, 3, 255, 0.5);
}

/* Buttons */
.king-addons-ai-settings button,
.king-addons-ai-settings .button {
    background: linear-gradient(135deg, #5b03ff, #4caf50);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(91, 3, 255, 0.3);
    font-family: 'Inter', sans-serif;
}

.king-addons-ai-settings button:hover,
.king-addons-ai-settings .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(91, 3, 255, 0.4);
    background: linear-gradient(135deg, #6614ff, #5cbf60);
}

.king-addons-ai-settings button:active,
.king-addons-ai-settings .button:active {
    transform: translateY(0);
}

/* Custom Save Button */
.king-addons-settings-footer {
    padding: 30px 40px;
    background: linear-gradient(135deg, #2d2f30, #1a1b1b);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: right;
}

.king-addons-save-button {
    background: linear-gradient(135deg, #5b03ff, #4caf50);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 32px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(91, 3, 255, 0.3);
    font-family: 'Inter', sans-serif;
    display: inline-block;
    text-transform: none;
    pointer-events: auto; /* Ensure button is clickable */
}

.king-addons-save-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(91, 3, 255, 0.4);
    background: linear-gradient(135deg, #6614ff, #5cbf60);
}

.king-addons-save-icon {
    font-size: 16px;
    margin-right: 8px;
}

/* Usage Statistics Enhanced */
.king-addons-ai-usage-stats {
    background: linear-gradient(135deg, rgba(45, 47, 48, 0.8), rgba(26, 27, 27, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    backdrop-filter: blur(20px);
}

.king-addons-ai-usage-stats table {
    width: 100%;
    margin-bottom: 20px;
    border-collapse: separate;
    border-spacing: 0;
}

.king-addons-ai-usage-stats table th {
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 0;
    text-align: left;
    width: 40%;
}

.king-addons-ai-usage-stats table td {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    padding: 12px 0;
    font-size: 14px;
}

.king-addons-ai-usage-bar-container {
    position: relative;
    height: 12px;
    background: rgba(45, 47, 48, 0.8);
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.king-addons-ai-usage-bar {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #5b03ff);
    border-radius: 8px;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.king-addons-ai-usage-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Warning/High Usage Colors */
.king-addons-ai-usage-bar[style*="width: 6"],
.king-addons-ai-usage-bar[style*="width: 7"] {
    background: linear-gradient(90deg, #ff9800, #ff5722);
}

.king-addons-ai-usage-bar[style*="width: 8"],
.king-addons-ai-usage-bar[style*="width: 9"] {
    background: linear-gradient(90deg, #ff5722, #f44336);
}

/* Info boxes styling */
.king-addons-ai-settings .notice,
.king-addons-ai-settings .updated {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(91, 3, 255, 0.05));
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 12px;
    color: #ffffff;
    padding: 16px 20px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
}

.king-addons-ai-settings .error {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1), rgba(255, 87, 34, 0.05));
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .king-addons-settings-header {
        padding: 24px;
    }
    
    .king-addons-settings-header-content {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .king-addons-settings-title {
        font-size: 24px;
    }
    
    .king-addons-ai-settings .form-table th,
    .king-addons-ai-settings .form-table td {
        padding: 16px 20px;
        display: block;
        width: 100%;
    }
    
    .king-addons-ai-settings .form-table th {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .king-addons-settings-footer {
        padding: 20px;
        text-align: center;
}

    .king-addons-ai-settings h2 + p {
        padding: 16px 20px;
    }
    
    .king-addons-ai-settings .notice {
        padding: 16px 20px !important;
        margin: 16px 0 !important;
    }
}

/* Dark Theme WordPress Admin Fix */
body {
    background: #101112 !important;
}

#wpcontent {
    background: #101112 !important;
}

.king-addons-ai-settings .wrap {
    background: transparent;
}

/* Hide default WordPress submit button */
.king-addons-ai-settings .submit {
    display: none;
}

/* Override WordPress admin styles */
.king-addons-ai-settings .form-table th {
    background: rgba(45, 47, 48, 0.5) !important;
    color: #ffffff !important;
}

.king-addons-ai-settings .form-table td {
    background: rgba(26, 27, 27, 0.3) !important;
    color: #ffffff !important;
}

/* Style WordPress notices to match theme */
.king-addons-ai-settings .notice {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(91, 3, 255, 0.05)) !important;
    border: 1px solid rgba(76, 175, 80, 0.4) !important;
    border-radius: 12px !important;
    color: #ffffff !important;
    padding: 20px 24px !important;
    margin: 20px 0 !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
}

.king-addons-ai-settings .notice p {
    color: rgba(255, 255, 255, 0.95) !important;
    margin: 0 !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

/* Info boxes (blue) */
.king-addons-ai-settings .notice:not(.notice-error):not(.notice-warning) {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.15), rgba(91, 3, 255, 0.05)) !important;
    border-color: rgba(33, 150, 243, 0.4) !important;
}

/* Warning boxes (orange/yellow) */
.king-addons-ai-settings .notice-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.05)) !important;
    border-color: rgba(255, 193, 7, 0.4) !important;
}

/* Error boxes (red) */
.king-addons-ai-settings .notice-error {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.15), rgba(255, 87, 34, 0.05)) !important;
    border-color: rgba(244, 67, 54, 0.4) !important;
}

/* Important/Info labels styling */
.king-addons-ai-settings .notice p strong:first-child,
.king-addons-ai-settings .notice p b:first-child {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-right: 8px !important;
}

/* Useful Links styling */
.king-addons-ai-settings .notice ul {
    margin: 12px 0 0 0 !important;
    padding-left: 20px !important;
}

.king-addons-ai-settings .notice li {
    margin-bottom: 8px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 14px !important;
}

.king-addons-ai-settings .notice li a {
    color: #8ab4f8 !important;
    font-weight: 500 !important;
}

/* Additional WordPress admin overrides */
.king-addons-ai-settings .wrap h1 {
    display: none; /* Hide default WordPress title since we have custom header */
}

.king-addons-ai-settings .regular-text {
    width: 300px;
    max-width: 100%;
}

.king-addons-ai-settings .small-text {
    width: 100px;
}

/* Style specific elements */
.king-addons-ai-settings .button-secondary {
    background: rgba(45, 47, 48, 0.8) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 500 !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
}

.king-addons-ai-settings .button-secondary:hover {
    background: rgba(60, 62, 63, 1) !important;
    border-color: #5b03ff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.king-addons-ai-settings .button-secondary:active {
    transform: translateY(0) !important;
}

/* Spinner styles */
.king-addons-ai-settings .spinner {
    filter: invert(1);
}

/* Success/error messages */
.king-addons-ai-settings .updated {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(91, 3, 255, 0.05)) !important;
    border: 1px solid rgba(76, 175, 80, 0.4) !important;
    border-radius: 12px !important;
    color: #ffffff !important;
}

.king-addons-ai-settings .error {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.15), rgba(255, 87, 34, 0.05)) !important;
    border: 1px solid rgba(244, 67, 54, 0.4) !important;
    border-radius: 12px !important;
    color: #ffffff !important;
}

/* Links styling */
.king-addons-ai-settings a {
    color: #8ab4f8;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.king-addons-ai-settings a:hover {
    color: #a8c7fa;
    text-decoration: underline;
}

.king-addons-ai-settings a:visited {
    color: #8ab4f8;
}

/* Modern Animations */
@keyframes slide-in-from-left {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-from-left {
    animation: slide-in-from-left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-up {
    animation: fade-in-up 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus animations */
/* .king-addons-ai-settings .form-table tr.focused {
    background: rgba(91, 3, 255, 0.05);
    transform: scale(1.01);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.king-addons-ai-settings .form-table tr.focused th,
.king-addons-ai-settings .form-table tr.focused td {
    background: rgba(91, 3, 255, 0.1) !important;
} */

/* Checkbox animation */
.checked-animation {
    animation: checkbox-bounce 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkbox-bounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Header icon animation */
.king-addons-settings-header-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading state for forms */
.form-saving {
    pointer-events: none;
    opacity: 0.8;
}

.form-saving::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 27, 27, 0.5);
    backdrop-filter: blur(2px);
    z-index: 10;
} 