/* Custom CSS für PhotoVolt CRM */

/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* PWA Specific Styles */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Navigation Active State */
.nav-item.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white !important;
}

.nav-item.active i {
    color: white !important;
}

.nav-item.active span {
    color: white !important;
}

/* Section Management */
.section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    appearance: none;
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Card Styles */
.card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0.75rem 0.75rem 0 0;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 0.75rem 0.75rem;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-neu {
    background: #dbeafe;
    color: #1e40af;
}

.badge-qualifiziert {
    background: #fef3c7;
    color: #92400e;
}

.badge-kunde {
    background: #d1fae5;
    color: #065f46;
}

.badge-inaktiv {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-anfrage {
    background: #dbeafe;
    color: #1e40af;
}

.badge-angebot {
    background: #fef3c7;
    color: #92400e;
}

.badge-verhandlung {
    background: #fed7aa;
    color: #c2410c;
}

.badge-abschluss {
    background: #d1fae5;
    color: #065f46;
}

.badge-verloren {
    background: #fee2e2;
    color: #991b1b;
}

.badge-niedrig {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-mittel {
    background: #fef3c7;
    color: #92400e;
}

.badge-hoch {
    background: #fed7aa;
    color: #c2410c;
}

.badge-kritisch {
    background: #fee2e2;
    color: #991b1b;
}

.badge-offen {
    background: #dbeafe;
    color: #1e40af;
}

.badge-in-bearbeitung {
    background: #fef3c7;
    color: #92400e;
}

.badge-warten {
    background: #fed7aa;
    color: #c2410c;
}

.badge-abgeschlossen {
    background: #d1fae5;
    color: #065f46;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .card {
        border-radius: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .form-input, .form-select {
        padding: 0.75rem;
        font-size: 1rem; /* Prevents zoom on iOS */
    }
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: #f9fafb;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #6b7280;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Animation Classes */
.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .5;
    }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 1rem 1.5rem;
    z-index: 1000;
    max-width: 20rem;
    animation: slideInRight 0.3s ease-out;
}

.notification.success {
    border-left: 4px solid #10b981;
}

.notification.error {
    border-left: 4px solid #ef4444;
}

.notification.warning {
    border-left: 4px solid #f59e0b;
}

.notification.info {
    border-left: 4px solid #3b82f6;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 9999px;
    transition: width 0.3s ease-in-out;
}

/* Deal Pipeline */
.pipeline-stage {
    background: white;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    min-height: 400px;
    padding: 1rem;
}

.pipeline-stage-header {
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.deal-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.deal-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

/* Calendar Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.calendar-day {
    background: white;
    padding: 0.75rem 0.5rem;
    min-height: 5rem;
    font-size: 0.875rem;
}

.calendar-day.other-month {
    background: #f9fafb;
    color: #9ca3af;
}

.calendar-day.today {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

.calendar-event {
    background: #dbeafe;
    color: #1e40af;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    cursor: pointer;
}

/* Mobile Touch Improvements */
@media (max-width: 768px) {
    .btn, .form-input, .form-select {
        min-height: 44px; /* iOS touch target size */
    }
    
    .table th, .table td {
        padding: 1rem 0.75rem;
    }
    
    .card {
        margin: 0 -0.5rem 1rem -0.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    /* This will be implemented in future versions */
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Media Manager Styles */
.media-folder {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.media-folder:hover {
    transform: scale(1.02) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.media-folder:active {
    transform: scale(0.98) translateY(1px);
    transition-duration: 0.1s;
}

.media-action-btn {
    transition: all 0.15s ease-in-out;
    transform: scale(0.9);
    opacity: 0.8;
}

.media-folder:hover .media-action-btn {
    transform: scale(1);
    opacity: 1;
}

.media-action-btn:hover {
    transform: scale(1.1) translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.media-action-btn:active {
    transform: scale(0.95) translateY(0);
}

/* Touch Feedback */
@media (pointer: coarse) {
    .media-folder {
        transition-duration: 0.1s;
    }
    
    .media-folder:active {
        transform: scale(0.95);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
}

/* File Upload Drag & Drop */
.drag-over {
    background: linear-gradient(45deg, #e3f2fd, #bbdefb) !important;
    border-color: #2196f3 !important;
    transform: scale(1.05);
}

/* Image Grid Styles */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 0.5rem;
    background: #f5f5f5;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-item:hover img {
    transform: scale(1.1);
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    gap: 0.5rem;
}

.image-item:hover .image-overlay {
    opacity: 1;
}

/* Document List Styles */
.document-item {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.document-item:hover {
    border-left-color: #3b82f6;
    background: #f8fafc;
    transform: translateX(4px);
}

/* File Type Icons */
.file-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 1.25rem;
}

.file-icon.pdf {
    background: #fee2e2;
    color: #dc2626;
}

.file-icon.doc {
    background: #dbeafe;
    color: #2563eb;
}

.file-icon.xls {
    background: #d1fae5;
    color: #059669;
}

.file-icon.txt {
    background: #f3f4f6;
    color: #6b7280;
}

/* Loading Animation for File Upload */
.upload-progress {
    position: relative;
    overflow: hidden;
}

.upload-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    animation: uploadProgress 2s infinite;
}

@keyframes uploadProgress {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Modal Animations */
.modal-enter {
    animation: modalEnter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-exit {
    animation: modalExit 0.2s cubic-bezier(0.4, 0, 1, 1);
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalExit {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
}

/* Thumbnail Styles */
.thumbnail {
    width: 100%;
    height: 8rem;
    object-fit: cover;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* File Counter Badge */
.file-counter {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

/* Print Styles */
@media print {
    .media-folder,
    .media-action-btn,
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    .image-item {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* Accessibility Improvements */
.media-folder:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.media-action-btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 1px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .media-folder {
        padding: 1rem;
        min-height: 120px;
    }
    
    .media-action-btn {
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }
}

/* Dark Mode Support (Future) */
@media (prefers-color-scheme: dark) {
    .media-folder {
        background: linear-gradient(135deg, #1f2937, #374151);
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .file-icon {
        filter: brightness(0.8);
    }
}