/**
 * Content Publicity Plugin - Modern Admin Styles
 * Beautiful iOS-style toggles, card layouts, and modern design
 * 
 * @package Content Publicity
 * @version 1.1.1
 */

/* ==========================================================================
   Modern Admin Base Layout
   ========================================================================== */

.cp-admin-wrap {
    background: #f0f0f1;
    margin: 0 -20px 0 -22px;
    padding: 20px;
    min-height: calc(100vh - 160px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.cp-admin-header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.cp-admin-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.cp-admin-header h1 {
    margin: 0 0 10px 0;
    font-size: 2.2em;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    color: white !important;
}

.cp-admin-header p {
    margin: 0;
    font-size: 1.1em;
    opacity: 0.95;
    position: relative;
    z-index: 1;
    color: white !important;
}

.cp-admin-header .cp-header-icon {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 4em;
    opacity: 0.2;
    z-index: 0;
}

/* ==========================================================================
   Modern Card System
   ========================================================================== */

.cp-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.cp-settings-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 
        0 2px 10px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.cp-settings-card:hover {
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.12),
        0 3px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.cp-settings-card.cp-card-featured {
    border-left: 4px solid #dc143c;
    background: white;
}

.cp-settings-card.cp-card-general {
    border-left: 4px solid #059669;
}

.cp-settings-card.cp-card-appearance {
    border-left: 4px solid #7c3aed;
}

.cp-settings-card.cp-card-social {
    border-left: 4px solid #2563eb;
}

.cp-settings-card.cp-card-embed {
    border-left: 4px solid #dc2626;
}

.cp-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.cp-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 18px;
    color: white !important;
    font-weight: bold;
}

.cp-card-featured .cp-card-icon {
    background: linear-gradient(135deg, #dc143c 0%, #b91c1c 100%);
}

.cp-card-general .cp-card-icon {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.cp-card-appearance .cp-card-icon {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.cp-card-social .cp-card-icon {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.cp-card-embed .cp-card-icon {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.cp-card-title {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
    color: #1e293b !important;
    line-height: 1.2;
}

.cp-card-description {
    color: #475569 !important;
    font-size: 0.95em;
    margin: 8px 0 0 0;
    line-height: 1.5;
}

/* ==========================================================================
   iOS-Style Toggle Switches
   ========================================================================== */

.cp-toggle-wrapper {
    margin: 15px 0;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.cp-toggle-wrapper:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.cp-toggle-featured {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.cp-toggle-featured:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.cp-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
}

.cp-toggle-label {
    flex: 1;
    margin-right: 15px;
    cursor: pointer;
}

.cp-toggle-title {
    font-weight: 600;
    color: #1e293b !important;
    margin: 0 0 4px 0;
    font-size: 1em;
}

.cp-toggle-description {
    color: #475569 !important;
    font-size: 0.85em;
    margin: 0;
    line-height: 1.4;
}

/* Toggle Switch Component */
.cp-toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

.cp-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    pointer-events: none;
}

.cp-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    border-radius: 28px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.05);
    pointer-events: all;
    z-index: 1;
}

.cp-toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 1px 3px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.cp-toggle-switch input:checked + .cp-toggle-slider {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(16, 185, 129, 0.2),
        0 0 0 3px rgba(16, 185, 129, 0.1);
}

.cp-toggle-switch input:checked + .cp-toggle-slider:before {
    transform: translateX(24px);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        0 1px 3px rgba(0, 0, 0, 0.15);
}

.cp-toggle-switch input:focus + .cp-toggle-slider {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.cp-toggle-featured .cp-toggle-switch input:checked + .cp-toggle-slider {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(16, 185, 129, 0.2),
        0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ==========================================================================
   Modern Form Elements
   ========================================================================== */

.cp-field-group {
    margin: 20px 0;
}

.cp-field-label {
    display: block;
    font-weight: 600;
    color: #1e293b !important;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.cp-field-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95em;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: #1e293b !important;
}

.cp-field-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.05),
        0 0 0 3px rgba(59, 130, 246, 0.1);
}

.cp-field-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95em;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: #1e293b !important;
}

.cp-field-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.05),
        0 0 0 3px rgba(59, 130, 246, 0.1);
}

.cp-field-description {
    color: #475569 !important;
    font-size: 0.85em;
    margin-top: 6px;
    line-height: 1.4;
}

/* ==========================================================================
   Checkbox Groups
   ========================================================================== */

.cp-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin: 15px 0;
}

.cp-checkbox-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.cp-checkbox-item:hover {
    border-color: #cbd5e1;
    background: #f9fafb;
}

.cp-checkbox-item.checked {
    border-color: #3b82f6;
    background: #eff6ff;
}

.cp-checkbox-item input[type="checkbox"] {
    margin: 0 10px 0 0;
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.cp-checkbox-label {
    font-weight: 500;
    color: #1e293b !important;
    cursor: pointer;
    flex: 1;
}

.cp-checkbox-code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.8em;
    color: #475569 !important;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

/* ==========================================================================
   Special Feature Highlights
   ========================================================================== */

.cp-feature-highlight {
    background: linear-gradient(135deg, #fefefe 0%, #f9f9f9 100%);
    border: 2px solid #dc143c;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

.cp-feature-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #dc143c 0%, #b91c1c 50%, #dc143c 100%);
}

.cp-feature-highlight h4 {
    color: #dc143c !important;
    margin: 0 0 10px 0;
    font-size: 1.2em;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.cp-feature-highlight h4::before {
    content: '❤️';
    margin-right: 8px;
    font-size: 1.1em;
}

.cp-feature-highlight p {
    color: #1e293b !important;
    margin: 8px 0;
    line-height: 1.6;
}

.cp-pro-tip {
    background: #ffffff !important;
    border: 2px solid #f59e0b;
    border-radius: 10px;
    padding: 16px;
    margin: 15px 0;
    position: relative;
}

.cp-pro-tip::before {
    content: '💡';
    position: absolute;
    top: 16px;
    left: 16px;
    font-size: 1.2em;
}

.cp-pro-tip p {
    margin: 0 0 0 30px !important;
    color: #1e293b !important;
    font-style: italic;
    line-height: 1.5;
    font-weight: 600 !important;
}

/* ==========================================================================
   Action Buttons
   ========================================================================== */

.cp-action-buttons {
    margin: 30px 0;
    text-align: center;
}

.cp-button-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white !important;
    border: none;
    padding: 14px 32px;
    border-radius: 10px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(59, 130, 246, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    text-decoration: none;
}

.cp-button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 20px rgba(59, 130, 246, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.15);
    color: white !important;
}

.cp-button-primary:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(59, 130, 246, 0.2),
        0 1px 3px rgba(0, 0, 0, 0.1);
}

.cp-button-primary:focus {
    outline: none;
    box-shadow: 
        0 4px 12px rgba(59, 130, 246, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.1),
        0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* ==========================================================================
   Upsell Section
   ========================================================================== */

.cp-upsell-card {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    border-radius: 16px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.cp-upsell-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="dots" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23dots)"/></svg>');
    pointer-events: none;
}

.cp-upsell-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.cp-upsell-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 24px;
}

.cp-upsell-title {
    font-size: 1.6em;
    font-weight: 700;
    margin: 0;
    position: relative;
    z-index: 1;
    color: white !important;
}

.cp-upsell-content {
    position: relative;
    z-index: 1;
}

.cp-upsell-content p {
    margin: 15px 0;
    line-height: 1.6;
    color: white !important;
    opacity: 0.95;
}

.cp-upsell-cta {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #1e293b !important;
    padding: 14px 28px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    margin-top: 15px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.cp-upsell-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
    color: #1e293b !important;
    text-decoration: none;
}

/* ==========================================================================
   Loading and Animation States
   ========================================================================== */

.cp-settings-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.cp-settings-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: cp-spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes cp-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.cp-fade-in {
    animation: cp-fadeIn 0.6s ease-out;
}

@keyframes cp-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cp-slide-in {
    animation: cp-slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cp-slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cp-checkbox-pulse {
    animation: cp-pulse 0.2s ease-out;
}

@keyframes cp-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.cp-toggle-changing .cp-toggle-slider {
    animation: cp-toggle-bounce 0.3s ease-out;
}

@keyframes cp-toggle-bounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.cp-field-focused {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
}

.cp-field-valid .cp-field-input {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.cp-field-invalid .cp-field-input {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.cp-save-indicator {
    position: fixed;
    top: 32px;
    right: 20px;
    background: #059669;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    z-index: 100000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cp-settings-saving {
    opacity: 0.8;
}

.cp-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1200px) {
    .cp-settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .cp-admin-wrap {
        margin: 0 -10px;
        padding: 15px;
    }
    
    .cp-admin-header {
        padding: 20px;
        text-align: center;
    }
    
    .cp-admin-header .cp-header-icon {
        position: static;
        transform: none;
        margin-bottom: 15px;
        display: block;
    }
    
    .cp-settings-card {
        padding: 20px;
    }
    
    .cp-card-header {
        flex-direction: column;
        text-align: center;
    }
    
    .cp-card-icon {
        margin: 0 0 10px 0;
    }
    
    .cp-checkbox-grid {
        grid-template-columns: 1fr;
    }
    
    .cp-toggle-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cp-toggle-switch {
        margin-top: 10px;
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .cp-admin-header h1 {
        font-size: 1.8em;
    }
    
    .cp-settings-card {
        margin: 0 -5px;
        border-radius: 8px;
    }
    
    .cp-upsell-card {
        margin: 20px -5px;
        border-radius: 12px;
    }
}

/* ==========================================================================
   Hide Default WordPress Styling
   ========================================================================== */

.wrap > h1,
.wrap > h2,
.form-table,
.wp-admin select {
    display: none !important;
}