/**
 * Vehizo Modules Page Styles
 * 
 * @package Vehizo
 * @version 4.2.0
 */

/* Module card layout overrides */
.module-card {
    padding: 1rem;
}
.module-header {
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.module-title {
    flex: 1 1 auto;
    min-width: 200px;
}
.module-status {
    flex-shrink: 0;
    white-space: nowrap;
}
.module-description {
    margin-bottom: 0.75rem;
}
.module-actions {
    padding-top: 0.75rem;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}
.module-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-settings,
.btn-manage,
.btn-upgrade {
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    height: 32px;
    min-width: 90px;
}

.modules-description {
    color: #6b7280;
    margin-bottom: 2rem;
}

.modules-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.modules-search input[type="search"] {
    min-width: 220px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #ffffff;
}

.modules-search input[type="search"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modules-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.view-toggle-btn {
    border: none;
    background: transparent;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    color: #111827;
    background: #e5e7eb;
}

.view-toggle-btn.is-active {
    background: #fff;
    color: #111827;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.modules-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.modules-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.module-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.module-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.module-card.active {
    border-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
}

.module-card.inactive {
    background: #f9fafb;
    opacity: 0.7;
}

.modules-grid.list-view .module-card {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    min-height: 60px;
}

.module-card.pro-unavailable,
.module-card.pro-feature.locked {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px dashed #cbd5e1;
    opacity: 0.95;
    position: relative;
}

.module-card.pro-unavailable:hover,
.module-card.pro-feature.locked:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
}

.module-card.pro-feature.locked .pro-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
}

.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.modules-grid.list-view .module-header {
    margin-bottom: 0;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.module-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    flex-wrap: nowrap;
}

.modules-grid.list-view .module-title {
    font-size: 0.9rem;
    gap: 0.5rem;
}

.modules-grid.list-view .module-icon {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    border-radius: 8px;
}

.module-icon {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
}

.module-icon.pro-disabled {
    background: #e5e7eb;
    color: #9ca3af;
    box-shadow: none;
}

/* Spezifische Icon-Farben für Module */
.module-card.contact .module-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.module-card.statistics .module-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.module-card.merkliste .module-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.module-card.csv-import .module-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.module-card.pro-vehicle-editor .module-icon {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.module-card#module-pdf-export .module-icon {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.module-card#module-test-drive .module-icon {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.module-card#module-seo .module-icon {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

.pro-badge {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 8px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.module-status {
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.modules-grid.list-view .module-status {
    padding: 0.25rem 0.65rem;
    font-size: 0.7rem;
}

.module-status.active {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.module-status.inactive {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.module-status.pro-unavailable,
.module-status.locked {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    border: 1px solid #93c5fd;
    font-weight: 700;
}

.module-description {
    color: #6b7280;
    line-height: 1.5;
    font-size: 0.9rem;
    flex-grow: 1;
}

.modules-grid.list-view .module-description {
    margin: 0;
    flex: 1 1 auto;
    font-size: 0.85rem;
    line-height: 1.4;
    padding: 0 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.module-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.modules-grid.list-view .module-toggle {
    justify-content: flex-end;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.modules-grid.list-view .toggle-switch {
    width: 40px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.modules-grid.list-view .toggle-slider:before {
    height: 14px;
    width: 14px;
}

input:checked+.toggle-slider {
    background-color: #10b981;
}

input:checked+.toggle-slider:before {
    transform: translateX(24px);
}

.modules-grid.list-view input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
    white-space: nowrap;
}

.modules-grid.list-view .toggle-label {
    display: none;
}

.module-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
    margin-top: auto;
    border-top: 1px solid #e5e7eb;
    padding-top: 0.85rem;
}

.modules-grid.list-view .module-actions {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 0.75rem;
    width: auto;
    max-width: none;
    display: flex;
    align-items: center;
}

.module-card.inactive .module-actions {
    border-top-color: transparent;
}

.module-card.has-settings .module-actions {
    justify-content: space-between;
}

.modules-grid.list-view .module-card.has-settings .module-actions {
    justify-content: flex-end;
    gap: 1rem;
}

.module-card.pro-unavailable .module-actions,
.module-card.pro-feature.locked .module-actions {
    border-top-color: #e5e7eb;
    justify-content: center;
}

.modules-grid.list-view .module-card.pro-unavailable .module-actions,
.modules-grid.list-view .module-card.pro-feature.locked .module-actions {
    justify-content: flex-end;
}

.btn-settings,
.btn-manage,
.btn-upgrade {
    background: #ffffff;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 2px solid;
    white-space: nowrap;
    height: 40px;
    min-width: 140px;
}

.modules-grid.list-view .btn-settings,
.modules-grid.list-view .btn-manage,
.modules-grid.list-view .btn-upgrade {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    height: 32px;
    min-width: 100px;
}

.btn-settings,
.btn-manage {
    color: #3b82f6;
    border-color: #3b82f6;
}

.btn-settings:hover,
.btn-manage:hover {
    background: #3b82f6;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-upgrade {
    color: #3b82f6;
    border-color: #3b82f6;
    font-weight: 700;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.btn-upgrade:hover {
    background: #3b82f6;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.save-indicator {
    display: none;
    position: fixed;
    top: 32px;
    right: 32px;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Modal Styles */
.vehizo-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.vehizo-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.vehizo-modal-header {
    padding: 24px 24px 0;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vehizo-modal-header h4 {
    margin: 0;
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 700;
}

.vehizo-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.vehizo-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.vehizo-modal-content {
    padding: 24px;
}

.vehizo-modal-content label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 500;
}

.vehizo-modal-content input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.vehizo-modal-content input[type="email"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.vehizo-modal-content small {
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: block;
}

.vehizo-modal-footer {
    padding: 0 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.vehizo-btn-save-settings {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.vehizo-btn-save-settings:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.vehizo-btn-save-settings:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modules-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .modules-view-toggle {
        width: 100%;
        justify-content: center;
    }

    .modules-search input[type="search"] {
        width: 100%;
    }

    .modules-grid {
        grid-template-columns: 1fr;
    }

    .modules-grid.list-view {
        display: grid;
    }

    .module-card {
        padding: 1rem;
    }

    .modules-grid.list-view .module-card {
        flex-direction: column;
        align-items: stretch;
        min-height: auto;
    }

    .modules-grid.list-view .module-header {
        min-width: auto;
        margin-bottom: 0.75rem;
    }

    .modules-grid.list-view .module-description {
        min-width: auto;
        margin-bottom: 0.75rem;
    }

    .module-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .module-card.has-settings .module-actions {
        justify-content: stretch;
    }

    .modules-grid.list-view .module-actions {
        width: 100%;
        justify-content: space-between;
        min-width: auto;
        flex-direction: row;
        align-items: center;
    }

    .vehizo-modal {
        width: 95%;
        margin: 0 auto;
    }

    .vehizo-modal-header,
    .vehizo-modal-content,
    .vehizo-modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
}