/**
 * Super Agency Theme - Admin Styles
 * Professional styling for the theme settings page
 */

.super-agency-settings * {
    box-sizing: border-box;
}

.super-agency-settings {
    max-width: 1200px;
    margin: 20px auto 0;
    padding: 0 20px;
}

/* Header Section */
.super-agency-header {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    border-left: 5px solid #2563EB;
}

.super-agency-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1d2327;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    line-height: 1.2;
}

.theme-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
}

.version-badge {
    background: #10B981;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: auto;
}

.super-agency-header p {
    color: #6B7280;
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.5;
}

/* Navigation Tabs */
.super-agency-settings .nav-tab-wrapper {
    background: #fff;
    border-radius: 12px 12px 0 0;
    padding: 0;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    border-bottom: none;
}

.super-agency-settings .nav-tab {
    background: #f8fafc;
    border: none;
    color: #6B7280;
    padding: 20px 30px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    margin: 0;
    border-radius: 0;
}

.super-agency-settings .nav-tab:hover {
    background: #e2e8f0;
    color: #2563EB;
}

.super-agency-settings .nav-tab.nav-tab-active,
.super-agency-settings .nav-tab.nav-tab-active:hover {
    background: #fff;
    color: #2563EB;
    border-bottom-color: #2563EB;
}

.super-agency-settings .nav-tab .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Tab Content */
.super-agency-settings .tab-content {
    background: #fff;
    padding: 40px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: 600px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.tab-panel h2 {
    margin: 0 0 20px 0;
    color: #1d2327;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
}

.tab-description {
    color: #6B7280;
    font-size: 1.1rem;
    margin: 0 0 30px 0;
    line-height: 1.6;
}

/* Cards Grid Layout - FIXED */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 30px;
    margin-top: 30px;
    width: 100%;
}

.settings-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.settings-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.15);
    border-color: #2563EB;
}

.card-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
}

.card-icon .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
}

.settings-card:hover .card-icon {
    transform: scale(1.1) rotate(3deg);
}

.settings-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.settings-card p {
    color: #6B7280;
    margin: 0 0 25px 0;
    line-height: 1.6;
}

.card-button {
    background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
    display: inline-block;
    box-shadow: none;
}

.card-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
    color: white !important;
}

/* Plugin Cards - COMPLETELY FIXED LAYOUT */
.plugin-card {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 30px;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 320px;
    max-height: none;
    height: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: visible;
    width: 100%;
}

.plugin-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.15);
    border-color: #2563EB;
}

/* Plugin Header - CLEAN LAYOUT WITHOUT ICONS */
.plugin-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-shrink: 0;
    width: 100%;
}

/* Plugin Info - FULL WIDTH WITHOUT ICON */
.plugin-info {
    flex: 1;
    width: 100%;
}

.plugin-info h4 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1d2327;
    margin: 0;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: normal;
    max-width: 100%;
}

/* Plugin Description - FIXED LAYOUT */
.plugin-description {
    color: #6B7280;
    margin: 0 0 25px 0;
    line-height: 1.6;
    flex-grow: 1;
    font-size: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: normal;
    max-width: 100%;
}

/* Plugin Actions - FIXED LAYOUT */
.plugin-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #f1f1f1;
    flex-shrink: 0;
    width: 100%;
}

/* Install Button - ENHANCED STYLING */
.install-button {
    background: #10B981;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-size: 0.95rem;
    min-width: 120px;
    text-align: center;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.install-button:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    color: white;
}

.install-button:disabled {
    background: #6B7280;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.install-button.installing {
    background: #F59E0B;
    cursor: wait;
}

.install-button.installing:hover {
    background: #F59E0B;
    transform: none;
    box-shadow: none;
}

.install-button.installed {
    background: #10B981;
    cursor: default;
}

.install-button.installed:hover {
    background: #10B981;
    transform: none;
    box-shadow: none;
}

.view-details {
    color: #2563EB !important;
    text-decoration: none !important;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    white-space: nowrap;
}

.view-details:hover {
    color: #1E40AF !important;
    background: rgba(37, 99, 235, 0.1);
    text-decoration: none !important;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #6B7280;
}

.spinner {
    border: 4px solid #e2e8f0;
    border-top: 4px solid #2563EB;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.no-plugins {
    text-align: center;
    padding: 60px 20px;
    color: #6B7280;
}

.no-plugins .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 20px;
    color: #D1D5DB;
}

.no-plugins h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #1d2327;
}

/* Changelog Styles */
.changelog {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.changelog-item {
    border-bottom: 1px solid #e2e8f0;
    padding: 25px;
}

.changelog-item:last-child {
    border-bottom: none;
}

.changelog-version {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.version-number {
    background: #2563EB;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.version-date {
    color: #6B7280;
    font-size: 0.95rem;
    font-weight: 500;
}

.changelog-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.changelog-content li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #4B5563;
    line-height: 1.6;
}

.changelog-content li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #10B981;
    font-weight: bold;
    font-size: 14px;
}

/* Success/Error Messages - Enhanced */
.super-agency-notice {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    animation: slideInFromTop 0.3s ease-out;
}

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

.super-agency-notice.success {
    background: #D1FAE5;
    border-left: 4px solid #10B981;
    color: #047857;
}

.super-agency-notice.error {
    background: #FEE2E2;
    border-left: 4px solid #EF4444;
    color: #DC2626;
}

.super-agency-notice .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.notice-dismiss-custom {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.notice-dismiss-custom:hover {
    opacity: 1;
}

.notice-dismiss-custom .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Getting Started - Setup Steps */
.setup-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.setup-step {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.setup-step:hover {
    border-color: #2563EB;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
}

.step-number {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.step-content p {
    color: #6B7280;
    margin: 0 0 14px 0;
    line-height: 1.6;
    font-size: 0.95rem;
}

.step-content .card-button {
    padding: 8px 18px;
    font-size: 0.9rem;
}

/* Responsive Design - IMPROVED */
@media (max-width: 1200px) {
    .super-agency-settings {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .super-agency-settings {
        margin-top: 10px;
        padding: 0 10px;
    }
    
    .super-agency-header {
        padding: 20px;
    }
    
    .super-agency-header h1 {
        font-size: 2rem;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .version-badge {
        margin-left: 0;
    }
    
    .super-agency-settings .nav-tab {
        padding: 15px 20px;
        font-size: 0.9rem;
        flex: 1;
        text-align: center;
        justify-content: center;
    }
    
    .super-agency-settings .tab-content {
        padding: 25px 20px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .plugin-header {
        flex-direction: row;
        text-align: left;
        align-items: flex-start;
        gap: 15px;
    }
    
    .plugin-icon {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }
    
    .plugin-info h4 {
        font-size: 1.2rem;
    }
    
    .plugin-actions {
        justify-content: flex-start;
        flex-direction: row;
        width: 100%;
        gap: 10px;
    }
    
    .install-button {
        min-width: 110px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .view-details {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .changelog-version {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .super-agency-header h1 {
        font-size: 1.5rem;
    }
    
    .super-agency-settings .nav-tab {
        padding: 12px 15px;
        font-size: 0.85rem;
    }
    
    .super-agency-settings .nav-tab .dashicons {
        display: none;
    }
    
    .super-agency-settings .tab-content {
        padding: 20px 15px;
    }
    
    .tab-panel h2 {
        font-size: 1.5rem;
    }
    
    .settings-card {
        padding: 20px;
    }
    
    .card-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 15px;
    }
    
    .card-icon .dashicons {
        font-size: 24px;
        width: 24px;
        height: 24px;
    }
    
    .plugin-card {
        padding: 20px;
        min-height: 280px;
    }
    
    .plugin-header {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    
    .plugin-icon {
        width: 48px;
        height: 48px;
        font-size: 16px;
    }
    
    .plugin-actions {
        justify-content: center;
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .install-button,
    .view-details {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* Dark mode compatibility */
@media (prefers-color-scheme: dark) {
    .super-agency-settings .wp-admin select {
        background-color: #1d2327;
        color: #f0f0f1;
    }
}

/* Print styles */
@media print {
    .super-agency-settings .nav-tab-wrapper,
    .super-agency-settings .card-button,
    .super-agency-settings .install-button,
    .super-agency-settings .search-box {
        display: none;
    }
    
    .super-agency-settings .tab-panel {
        display: block !important;
    }
    
    .super-agency-settings .settings-card,
    .super-agency-settings .plugin-card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}

/* Additional fixes for text overflow */
.plugin-card * {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Ensure cards don't break on very long plugin names */
.plugin-info h4 {
    font-size: 1.25rem !important;
    line-height: 1.3 !important;
    margin-bottom: 5px !important;
    max-width: 100% !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
}

/* Fix grid responsiveness */
@media (min-width: 769px) and (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

@media (min-width: 1025px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

/* Ensure proper card height distribution */
.cards-grid .plugin-card {
    align-self: stretch;
}