/* Grid System and Layout */

/* Base Grid */
.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px;
    box-sizing: border-box;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: -12px;
}

.col {
    padding: 12px;
    box-sizing: border-box;
}

/* Column Widths */
.col-1 { flex: 0 0 8.33%; max-width: 8.33%; }
.col-2 { flex: 0 0 16.66%; max-width: 16.66%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.33%; max-width: 33.33%; }
.col-5 { flex: 0 0 41.66%; max-width: 41.66%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.33%; max-width: 58.33%; }
.col-8 { flex: 0 0 100%; max-width: 66.66%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.33%; max-width: 83.33%; }
.col-11 { flex: 0 0 91.66%; max-width: 91.66%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* Responsive Breakpoints */
@media (max-width: 576px) {
    .col { flex: 0 0 100%; max-width: 100%; }
}

@media (min-width: 577px) and (max-width: 992px) {
    .col-1 { flex: 0 0 25%; max-width: 25%; }
    .col-2 { flex: 0 0 50%; max-width: 50%; }
    .col-3 { flex: 0 0 75%; max-width: 75%; }
    .col-4 { flex: 0 0 100%; max-width: 100%; }
}

/* Spacing Scale */
.spacing-8 { margin: 8px; padding: 8px; }
.spacing-8-row { margin: 0px 8px 0px 8px; padding: 8px; }
.spacing-16 { margin: 16px; padding: 16px; }
.spacing-16-row { margin: 0px 16px 0px 16px; padding: 8px; }
.spacing-24 { margin: 4px; padding: 24px; }
.spacing-32 { margin: 32px; padding: 32px; }
.spacing-40 { margin: 40px; padding: 40px; }
.spacing-48 { margin: 48px; padding: 48px; }

/* Card Layout */
.card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 16px;
    min-height: 200px;
    margin-top: 0;
    margin-bottom: 0;
    transition: box-shadow 0.2s ease-in-out;
    z-index: 5;
    max-width: 100%;
}

.card:hover {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Typography */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 24px;
    color: #1F2937;
    background-color: var(--neutral-bg);
}

h1 {
    font-size: 24px;
    line-height: 32px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #1F2937;
}

h2 {
    font-size: 20px;
    line-height: 28px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #1F2937;
}

p, .body-text {
    font-size: 16px;
    line-height: 24px;
    font-weight: 400;
    letter-spacing: 0.1px;
    color: #1F2937;
}

.small-text {
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
    letter-spacing: 0.1px;
    color: #6B7280;
    margin: 0px !important;
    margin-top: 4px !important;
}

.caption {
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
    letter-spacing: 0.1px;
    color: #6B7280;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-justify {
    text-align: justify;
}

/* Utility classes */
.text-align-center {
    text-align: center;
}

.display-grid {
    display: grid;
}

/* Color Palette */

:root {
    --primary-color: #1E3A8A;
    --primary-hover: #3B82F6;
    --primary-active: #60A5FA;
    --secondary-color: #6B46C1;
    --secondary-hover: #8B5CF6;
    --secondary-active: #A78BFA;
    --success-color: #10B981;
    --success-hover: #34D399;
    --success-active: #6EE7B7;
    --warning-color: #F59E0B;
    --warning-hover: #FBBF24;
    --warning-active: #FCD34D;
    --neutral-bg: #F9FAFB;
    --neutral-border: #E5E7EB;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-placeholder: #9CA3AF;
}

/* Buttons and Interactive Elements */

.primary-button {
    background-color: var(--primary-color);
    color: #FFFFFF;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.primary-button:hover {
    background-color: var(--primary-hover);
    color: #FFFFFF !important;
}

.primary-button:active {
    background-color: var(--primary-active);
    transform: scale(0.98);
}

.primary-button:disabled {
    background-color: var(--text-placeholder);
    color: #D1D5DB;
    cursor: not-allowed;
}

.secondary-button {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.secondary-button:hover {
    background-color: var(--neutral-border);
}

.secondary-button:active {
    background-color: var(--neutral-border);
    transform: scale(0.98);
}

.secondary-button:disabled {
    background-color: var(--text-placeholder);
    color: #D1D5DB;
    cursor: not-allowed;
}

/* Shadows and Elevation */

.modal {
    z-index: 10;
}

.base-element {
    z-index: 0;
}

/* Icons and Graphics */

.icon {
    width: 24px;
    height: 24px;
    fill: var(--primary-color);
    stroke-width: 2px;
    margin: 8px;
}

.icon-small {
    width: 16px;
    height: 16px;
}

.icon-large {
    width: 32px;
    height: 32px;
}

.icon-secondary {
    fill: var(--secondary-color);
}

.icon-success {
    fill: var(--success-color);
}

.icon-warning {
    fill: var(--warning-color);
}

.custom-graphic {
    stroke-width: 1.5px;
    fill: none;
    stroke: var(--primary-color);
}

/* Responsiveness and Accessibility */

/* Media Queries for Font and Padding Adjustments */
@media (max-width: 576px) {
    body {
        font-size: 14px;
        line-height: 22px;
    }
    .primary-button, .secondary-button {
        padding: 10px 20px;
    }
}

@media (min-width: 577px) and (max-width: 992px) {
    body {
        font-size: 15px;
        line-height: 23px;
    }
    .primary-button, .secondary-button {
        padding: 11px 22px;
    }
}

/* Focus States for Accessibility */
.primary-button:focus, .secondary-button:focus {
    outline: 2px solid var(--primary-hover);
    outline-offset: 2px;
}

/* Screen Reader Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Animation and Transitions */

/* Remove universal transition to prevent performance issues */
* {
    transition: none; /* Removing universal transition */
}

/* Apply transitions only to specific elements */
.saiap-element,
.primary-button, 
.secondary-button, 
.card {
    transition: all 0.3s ease;
}

/* WordPress Admin Integration */
.saiap-admin-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
}

/* Extend background to fill WordPress admin content area */
#wpcontent {
    background-color: var(--neutral-bg);
}

#wpbody-content {
    padding-bottom: 40px;
}

/* Ensure our styles don't break WordPress admin UI */
#wpcontent .saiap-admin-page button:not(.primary-button):not(.secondary-button) {
    transition: none;
    transform: none;
}

/* Fix potential conflicts with WordPress admin */
.saiap-admin-page h1,
.saiap-admin-page h2,
.saiap-admin-page p {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Ensure our styles don't affect WordPress UI elements */
#adminmenu,
#wpadminbar,
.wp-core-ui .button,
.wp-core-ui .button-primary {
    transition: none;
    transform: none;
}

/* Loading States */
.skeleton-loader {
    background: linear-gradient(90deg, #E5E7EB 25%, #F9FAFB 50%, #E5E7EB 75%);
    opacity: 0.7;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Additional Responsive Behavior */

/* Mobile-specific adjustments */
@media (max-width: 576px) {
    .container {
        padding: 16px;
    }
    
    h1 {
        font-size: 22px;
        line-height: 30px;
    }
    
    h2 {
        font-size: 18px;
        line-height: 26px;
    }
    
    .card {
        padding: 12px;
        min-height: 150px;
    }
    
    .primary-button, 
    .secondary-button {
        width: 100%;
        text-align: center;
        padding: 10px 16px;
    }
    
    .spacing-24 {
        margin: 16px;
        padding: 16px;
    }
    
    .spacing-32 {
        margin: 24px;
        padding: 24px;
    }
    
    .spacing-40 {
        margin: 32px;
        padding: 32px;
    }
    
    .saiap-prompt-buttons {
        grid-template-columns: 1fr;
    }
    
    #saiap-all-prompts-modal {
        width: 95%;
        max-height: 90vh;
        padding: 16px;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 577px) and (max-width: 992px) {
    .container {
        padding: 20px;
    }
    
    .card {
        padding: 16px;
    }
    
    .saiap-prompt-buttons {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    
    #saiap-all-prompts-modal {
        width: 90%;
        max-width: 700px;
    }
}

/* Ensure form elements are responsive */
@media (max-width: 992px) {
    input[type="text"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    .saiap-admin-page .nav-tab {
        padding: 8px 12px;
        margin-right: 2px;
        font-size: 14px;
    }
    
    .saiap-admin-page .nav-tab-wrapper {
        margin-bottom: 2px;
    }
}

/* Accessibility improvements */
.primary-button:focus,
.secondary-button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-hover);
    outline-offset: 2px;
}

/* Fix for checkboxes and radio buttons */
input[type="checkbox"],
input[type="radio"] {
    height: 20px;
    width: 20px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Custom Radio Button Styling */
.saiap-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.saiap-radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 0;
    transition: all 0.2s ease-in-out;
}

.saiap-radio-option:hover {
    background-color: var(--neutral-bg);
    border-radius: 4px;
    padding: 8px 12px;
    margin: 0 -12px;
}

.saiap-radio-option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--neutral-border);
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    flex-shrink: 0;
}

.saiap-radio-option input[type="radio"]:hover {
    border-color: var(--primary-hover);
}

.saiap-radio-option input[type="radio"]:checked {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

.saiap-radio-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #fff;
}

.saiap-radio-option input[type="radio"]:focus {
    outline: 2px solid var(--primary-hover);
    outline-offset: 2px;
}

.saiap-radio-option span {
    margin: 0;
    line-height: 1.4;
}

/* Animations and Loading States */

/* Fade In Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* Slide In Animation */
@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

/* Pulse Animation for Skeleton Loaders */
@keyframes pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Enhanced Skeleton Loader */
.skeleton-loader {
    background: linear-gradient(90deg, #E5E7EB 25%, #F9FAFB 50%, #E5E7EB 75%);
    background-size: 200% 100%;
    animation: pulse 1.5s infinite;
    opacity: 0.7;
    border-radius: 12px;
    height: 200px;
    width: 100%;
}

.skeleton-line {
    height: 20px;
    margin-bottom: 8px;
    width: 100%;
    background: linear-gradient(90deg, #E5E7EB 25%, #F9FAFB 50%, #E5E7EB 75%);
    background-size: 200% 100%;
    animation: pulse 1.5s infinite;
    opacity: 0.7;
    border-radius: 4px;
}

.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-line.long { width: 100%; }

/* Button Loading State */
.button-loading {
    position: relative;
    color: transparent !important;
}

.button-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid var(--neutral-border);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Focus States */
.card:focus-within {
    box-shadow: 0 0 0 2px var(--primary-hover);
}

/* UI Polish */
.saiap-admin-page input[type="text"],
.saiap-admin-page input[type="password"],
.saiap-admin-page select,
.saiap-admin-page textarea {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--neutral-border);
}

.saiap-admin-page input[type="text"]:hover,
.saiap-admin-page input[type="password"]:hover,
.saiap-admin-page select:hover,
.saiap-admin-page textarea:hover {
    border-color: var(--primary-hover);
}

.saiap-admin-page input[type="text"]:focus,
.saiap-admin-page input[type="password"]:focus,
.saiap-admin-page select:focus,
.saiap-admin-page textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.2);
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--text-primary);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
    line-height: 1.4;
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--text-primary) transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
} 

/* Edit with AI Tab Specific Styles */
.saiap-screenshot-placeholder {
    background: var(--neutral-bg);
    border: 2px dashed var(--neutral-border);
    padding: 40px;
    border-radius: 8px;
    margin: 20px 0;
}

.saiap-placeholder-text {
    color: var(--text-secondary);
    margin: 0;
    font-style: italic;
}

.saiap-instructions-list {
    text-align: left;
    display: inline-block;
    max-width: 600px;
    margin: 0 auto;
}

.saiap-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.saiap-feature-card {
    background: var(--neutral-bg);
    padding: 16px;
    border-radius: 6px;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .saiap-features-grid {
        grid-template-columns: 1fr;
    }
    
    .saiap-instructions-list {
        max-width: 100%;
    }
    
    .saiap-screenshot-placeholder {
        padding: 24px;
        margin: 16px 0;
    }
}