/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #1f2937;
    background-color: #f9fafb;
    overflow-x: hidden;
}

/* iPad Landscape Optimization */
@media (min-width: 768px) and (orientation: landscape) {
    body {
        font-size: 18px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.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;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #2563eb;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Main Navigation */
.main-nav {
    background: #2563eb;
    color: white;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

.nav-menu {
    display: flex;
    padding: 0 24px;
}

.nav-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 16px 24px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.nav-button:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-button.active {
    color: white;
    border-bottom-color: #60a5fa;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 120px);
    padding: 24px;
}

/* Views */
.view {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.view-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
}

/* Buttons */
.primary-button {
    background: #2563eb;
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 56px;
    min-width: 120px;
}

.primary-button:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.primary-button:active {
    transform: translateY(0);
}

.secondary-button {
    background: #6b7280;
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 56px;
    min-width: 120px;
}

.secondary-button:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.back-button {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.back-button:hover {
    background: #e5e7eb;
}

.sync-button {
    background: #10b981;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.sync-button:hover {
    background: #059669;
}

.sync-icon {
    font-size: 20px;
    display: inline-block;
    animation: rotate 2s linear infinite paused;
}

.sync-button.syncing .sync-icon {
    animation-play-state: running;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Projects List */
.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.project-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: #2563eb;
}

.project-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1f2937;
}

.project-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #6b7280;
}

.project-technology {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    width: fit-content;
}

.project-progress {
    margin-top: 16px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #10b981;
    transition: width 0.3s;
}

.progress-text {
    font-size: 14px;
    color: #6b7280;
    margin-top: 8px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: #6b7280;
}

.empty-state p {
    font-size: 18px;
    margin-bottom: 24px;
}

/* Forms */
.project-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
    font-size: 16px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 16px;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    font-size: 16px;
    transition: border-color 0.2s;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Technology Selection */
.technology-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.tech-option {
    position: relative;
}

.tech-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.tech-label {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.tech-option input[type="radio"]:checked + .tech-label {
    border-color: #2563eb;
    background: #dbeafe;
}

.tech-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 8px;
}

.tech-info h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.tech-info p {
    font-size: 14px;
    color: #6b7280;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
}

/* Project Phases */
.project-phases {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.phase-tabs {
    display: flex;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.phase-tab {
    flex: 1;
    padding: 20px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
    border-bottom: 3px solid transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.phase-tab:hover {
    background: #f3f4f6;
    color: #374151;
}

.phase-tab.active {
    background: white;
    color: #2563eb;
    border-bottom-color: #2563eb;
}

/* Phase Status Indicators */
.phase-indicator {
    font-size: 14px;
    margin-left: 8px;
}

.phase-tab.status-red {
    border-left: 4px solid #ef4444;
}

.phase-tab.status-yellow {
    border-left: 4px solid #f59e0b;
}

.phase-tab.status-green {
    border-left: 4px solid #10b981;
}

.phase-tab.status-gray {
    border-left: 4px solid #9ca3af;
}

/* Help Tab - Visually Different */
.help-tab {
    background: linear-gradient(135deg, #8b5cf6, #a855f7) !important;
    color: white !important;
    border: none !important;
    margin-left: 12px;
    position: relative;
    overflow: hidden;
}

.help-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.help-tab:hover::before {
    left: 100%;
}

.help-tab:hover {
    background: linear-gradient(135deg, #7c3aed, #9333ea) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.help-tab.active {
    background: linear-gradient(135deg, #6d28d9, #7c3aed) !important;
    border-bottom-color: #8b5cf6 !important;
}

.phase-content {
    padding: 32px;
    min-height: 400px;
}

/* Checklist Items */
.checklist {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.checklist-item {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.checklist-item.completed {
    background: #ecfdf5;
    border-color: #10b981;
}

.checklist-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.checklist-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.checklist-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.checklist-content {
    margin-left: 40px;
}

.checklist-description {
    color: #6b7280;
    margin-bottom: 16px;
}

.checklist-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 500;
    color: #374151;
}

.input-group input,
.input-group select,
.input-group textarea {
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
}

/* Media Capture */
.media-capture {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.capture-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.capture-button:hover {
    background: #e5e7eb;
}

.media-preview {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.media-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f59e0b;
    color: white;
    text-align: center;
    padding: 8px;
    font-weight: 600;
    z-index: 1000;
}

/* Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 24px;
    left: 24px;
    right: 24px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 1000;
}

.install-prompt p {
    flex: 1;
    font-weight: 500;
}

/* Phase Blocked Dialog */
.phase-blocked-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.phase-blocked-dialog {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.phase-blocked-dialog h3 {
    margin-bottom: 16px;
    color: #ef4444;
    font-size: 20px;
}

.phase-blocked-dialog p {
    margin-bottom: 16px;
    color: #374151;
    line-height: 1.5;
}

.dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Required Field Indicators */
.checklist-item.has-required {
    border-left: 4px solid #f59e0b;
}

.checklist-item.has-required.completed {
    border-left-color: #10b981;
}

.input-group.required label::after {
    content: ' *';
    color: #ef4444;
    font-weight: bold;
}

/* Project Title Clickable */
.project-title-clickable {
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    position: relative;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.05);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.project-title-clickable::before {
    content: "ℹ️";
    font-size: 14px;
    margin-right: 8px;
    opacity: 0.7;
}

.project-title-clickable:hover {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.project-title-clickable::after {
    content: "Klicken für Details";
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #6b7280;
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
}

.project-title-clickable:hover::after {
    opacity: 1;
}

/* Project Info Modal */
.project-info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.project-info-dialog {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.project-info-dialog h3 {
    margin-bottom: 20px;
    color: #2563eb;
    font-size: 24px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

.project-info-section {
    margin-bottom: 24px;
}

.project-info-section h4 {
    margin-bottom: 12px;
    color: #374151;
    font-size: 18px;
    font-weight: 600;
}

.project-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.project-info-item {
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #2563eb;
}

.project-info-item.full-width {
    grid-column: 1 / -1;
}

.project-info-label {
    font-weight: 600;
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 4px;
}

.project-info-value {
    color: #374151;
    font-size: 16px;
}

.project-info-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.contact-info {
    background: #eff6ff;
    border-left-color: #3b82f6;
}

.project-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.project-status.active {
    background: #dcfce7;
    color: #166534;
}

.project-status.completed {
    background: #dbeafe;
    color: #1e40af;
}

.project-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: #10b981;
    transition: width 0.3s ease;
}

/* Device List Styles */
.device-list-container {
    margin-top: 16px;
}

.device-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.device-list-header h4 {
    margin: 0;
    color: #374151;
    font-size: 18px;
}

.add-device-button {
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.add-device-button:hover {
    background: #059669;
}

.device-entries {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.device-entry {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s;
}

.device-entry:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.device-controls {
    display: grid;
    grid-template-columns: 2fr 100px 2fr 40px;
    gap: 12px;
    align-items: center;
}

.device-type-select,
.device-quantity,
.device-notes {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.device-type-select:focus,
.device-quantity:focus,
.device-notes:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.device-type-select {
    background: white;
}

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

.remove-device-button {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-device-button:hover {
    background: #dc2626;
}

.no-devices-message {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 24px;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    margin-top: 16px;
}

/* Responsive Device List */
@media (max-width: 768px) {
    .device-controls {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .device-list-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .add-device-button {
        width: 100%;
    }
}

/* Help Content Styles */
.help-content {
    max-width: 800px;
    margin: 0 auto;
}

.help-header {
    text-align: center;
    margin-bottom: 32px;
    padding: 24px;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border-radius: 12px;
    border-left: 4px solid #8b5cf6;
}

.help-header h2 {
    color: #374151;
    margin-bottom: 8px;
    font-size: 28px;
}

.help-header p {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
}

.help-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #8b5cf6;
    transition: all 0.2s;
}

.help-section:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.help-section h3 {
    color: #374151;
    margin-bottom: 16px;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-section-content {
    color: #4b5563;
    line-height: 1.6;
}

.help-section-content p {
    margin-bottom: 12px;
}

.help-section-content ul,
.help-section-content ol {
    margin-bottom: 12px;
    padding-left: 20px;
}

.help-section-content li {
    margin-bottom: 8px;
}

.help-section-content strong {
    color: #374151;
}

.help-footer {
    margin-top: 32px;
    padding: 24px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-radius: 12px;
    border-left: 4px solid #3b82f6;
    text-align: center;
}

.help-contact h3 {
    color: #1e40af;
    margin-bottom: 8px;
}

.help-contact p {
    color: #3b82f6;
    margin: 0;
}

/* Help Content Responsive */
@media (max-width: 768px) {
    .help-content {
        padding: 16px;
    }
    
    .help-header,
    .help-section,
    .help-footer {
        padding: 16px;
    }
    
    .help-header h2 {
        font-size: 24px;
    }
    
    .help-section h3 {
        font-size: 18px;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }
    
    .view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .technology-selection {
        grid-template-columns: 1fr;
    }
    
    .phase-tabs {
        flex-direction: column;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .nav-menu {
        display: none;
        flex-direction: column;
        padding: 0;
    }
    
    .nav-menu.open {
        display: flex;
    }
    
    .nav-button {
        padding: 16px 24px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Print Styles */
@media print {
    .main-nav,
    .offline-indicator,
    .install-prompt {
        display: none;
    }
    
    .main-content {
        padding: 0;
    }
    
    .project-card,
    .checklist-item {
        break-inside: avoid;
    }
}
