/* ============================================================================
   PROFESSIONAL BUSINESS DESIGN - easybill Manager Pro
   Kombiniert mit isybill Features
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #0a0e1a;
    --bg-panel: rgba(18, 25, 38, 0.85);
    --bg-card: rgba(22, 32, 48, 0.9);
    --border: rgba(59, 130, 246, 0.15);
    --border-hover: rgba(59, 130, 246, 0.4);
    
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    
    --primary: #007bff;
    --primary-light: #60a5fa;
    --primary-dark: #0056b3;
    
    --accent: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.5);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 24px rgba(0, 123, 255, 0.2);
    
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    padding: 15px;
    margin: 0;
    overflow-x: hidden;
    position: relative;
    font-size: 16px;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 123, 255, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(14, 165, 233, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

body.logged-in #loginContainer { display: none !important; }
body:not(.logged-in) #appContainer { display: none !important; }

/* ============================================================================
   LAYOUT
   ============================================================================ */

.container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90vh;
    position: relative;
    z-index: 1;
}

#appContainer {
    max-width: 1200px;
    margin: 0 auto;
}

.glass {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px) saturate(180%);
    box-shadow: var(--shadow-md);
}

.card { 
    border-radius: var(--radius); 
    padding: 28px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.4;
}

.login-box { 
    max-width: 420px; 
    width: 100%;
    animation: fadeInUp 0.5s ease-out;
}

/* ============================================================================
   BRAND & ICONS
   ============================================================================ */

.brand { 
    display: flex; 
    gap: 12px; 
    align-items: center; 
    margin-bottom: 28px;
}

.brand h1 { 
    font-size: 28px; 
    font-weight: 700;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.brand p { 
    color: var(--text-dim); 
    font-size: 13px;
    letter-spacing: 0.2px;
}

.icon { 
    width: 24px; 
    height: 24px; 
    fill: currentColor;
    transition: var(--transition);
}

/* ============================================================================
   FORMS
   ============================================================================ */

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

.form-group label { 
    display: block; 
    margin-bottom: 8px; 
    color: var(--text); 
    font-size: 14px;
    font-weight: 500;
}

.form-group input, 
.form-group select,
.form-group textarea {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #495057;
    color: var(--text);
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus, 
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(22, 32, 48, 1);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.08), var(--shadow-glow);
    transform: translateY(-1px);
}

.form-group input::placeholder, 
.form-group textarea::placeholder {
    color: var(--text-dim);
}

textarea { resize: vertical; min-height: 110px; }

/* Switch Toggle */
.switch-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

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

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

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

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn:hover::before {
    width: 280px;
    height: 280px;
}

.btn:active {
    transform: scale(0.98);
}

.btn.full { width: 100%; }

.btn-primary { 
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.25);
}

.btn-primary:hover { 
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.35), var(--shadow-glow);
}

.ghost { 
    background: transparent; 
    color: var(--text); 
    border: 1px solid var(--border);
}

.ghost:hover { 
    border-color: var(--primary); 
    color: var(--primary);
    background: rgba(0, 123, 255, 0.05);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
}

/* ============================================================================
   HEADER & NAVIGATION
   ============================================================================ */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    animation: slideDown 0.4s ease-out;
}

.user-info { 
    display: flex; 
    gap: 12px; 
    align-items: center; 
    color: var(--text-dim);
    font-size: 14px;
}

.nav-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px;
    border-radius: var(--radius);
    position: relative;
    z-index: 1;
    animation: slideDown 0.5s ease-out 0.1s both;
}

.tab-btn {
    background: var(--bg-panel);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 14px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    font-weight: 500;
    position: relative;
    font-size: 14px;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.tab-btn.active { 
    border-color: var(--primary); 
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.tab-btn.active::after {
    transform: scaleX(1);
}

.tab-btn:hover:not(.active) { 
    background: var(--bg-card);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    color: var(--text);
}

.tab-btn .icon { opacity: 0.8; }
.tab-btn.active .icon { opacity: 1; }

/* ============================================================================
   TAB CONTENT
   ============================================================================ */

.tab-content { 
    display: none;
    position: relative;
    z-index: 1;
}

.tab-content.active { 
    display: block; 
    animation: fadeInScale 0.3s ease-out;
}

.content-section { margin-bottom: 20px; }

.section-header { 
    display: flex; 
    justify-content: space-between; 
    gap: 16px; 
    flex-wrap: wrap; 
    margin-bottom: 20px;
}

.section-header .title { 
    display: flex; 
    gap: 12px; 
    align-items: center;
}

.section-header .title .icon {
    color: var(--primary);
}

.section-header h2 { 
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.section-header p { 
    color: var(--text-dim);
    font-size: 13px;
}

.action-bar { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap;
    align-items: center;
}

.search-input { 
    flex: 1; 
    min-width: 220px;
}

/* ============================================================================
   CHAT INTERFACE (from isybill)
   ============================================================================ */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #1a1a1a;
    border-radius: 12px;
    margin-bottom: 16px;
}

.message {
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 12px;
    max-width: 80%;
    animation: messageSlide 0.3s ease-out;
}

.message.isy {
    background: linear-gradient(135deg, rgba(0,123,255,0.2), rgba(0,123,255,0.1));
    border-left: 3px solid var(--primary);
    margin-right: auto;
}

.message.user {
    background: rgba(255,255,255,0.1);
    margin-left: auto;
    text-align: right;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input-wrapper textarea {
    flex: 1;
    resize: none;
    border-radius: 12px;
    padding: 12px;
    background: #1a1a1a;
    border: 1px solid #495057;
    color: var(--text);
    font-family: inherit;
}

.chat-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* ============================================================================
   CONTENT BOXES & CARDS
   ============================================================================ */

.output-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    min-height: 180px;
    backdrop-filter: blur(10px);
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    animation: staggerIn 0.5s ease-out;
}

.data-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.data-card:hover { 
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

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

.card-header .icon {
    color: var(--primary-light);
}

.card-title { 
    font-weight: 700;
    font-size: 16px;
}

.card-meta { 
    color: var(--text-dim); 
    font-size: 12px;
    opacity: 0.8;
}

.data-card p { 
    color: var(--text-dim); 
    margin-bottom: 6px; 
    font-size: 14px;
    line-height: 1.5;
}

.data-card strong { 
    color: var(--text);
    font-weight: 600;
}

.project-card {
    padding: 12px;
    margin: 8px 0;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.2);
}

.project-card:hover {
    background: rgba(255,255,255,0.2);
    border-color: var(--primary);
}

/* ============================================================================
   FAB & MODALS (iPhone Style from isybill)
   ============================================================================ */

.fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,123,255,0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(0,123,255,0.6);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: linear-gradient(135deg, #333 0%, #000 100%);
    border-radius: 40px;
    padding: 20px;
    width: 380px;
    max-height: 80vh;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0,0,0,0.9), 0 0 80px rgba(255,255,255,0.2);
    border: 3px solid rgba(255,255,255,0.2);
    transform: perspective(1200px) translateY(30px) scale(1.05);
    animation: fly-in 0.6s ease-out;
}

@keyframes fly-in {
    from {
        transform: perspective(1200px) rotateX(25deg) translateY(-100px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: perspective(1200px) translateY(30px) scale(1.05);
        opacity: 1;
    }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 28px;
    background: linear-gradient(135deg, #666 0%, #000 100%);
    border-radius: 0 0 18px 18px;
    z-index: 10;
}

.modal-inner {
    background: linear-gradient(to bottom, #1e3a8a 0%, #000000 100%);
    border-radius: 30px;
    height: 100%;
    max-height: 70vh;
    padding: 50px 20px 20px 20px;
    overflow-y: auto;
    color: #ffffff;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.close-modal {
    position: absolute;
    top: 60px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-modal:hover {
    background: rgba(255,255,255,0.2);
}

/* ============================================================================
   ADMIN PANEL
   ============================================================================ */

.admin-panel {
    margin-bottom: 20px;
    animation: slideDown 0.5s ease-out;
}

.admin-panel h3 {
    margin-bottom: 20px;
    font-size: 20px;
    color: var(--text);
}

.form-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 
    gap: 16px;
    margin-bottom: 16px;
}

/* ============================================================================
   STATUS & MESSAGES
   ============================================================================ */

.placeholder { 
    color: var(--text-dim); 
    text-align: center; 
    padding: 36px 18px;
    font-style: italic;
    opacity: 0.6;
}

.loading,
.spinner { 
    display: inline-block; 
    width: 38px; 
    height: 38px; 
    border: 3px solid rgba(0, 123, 255, 0.1); 
    border-top-color: var(--primary); 
    border-radius: 50%; 
    animation: spin 0.8s linear infinite;
}

.status-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 22px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    display: none;
    z-index: 100;
    animation: slideUp 0.3s ease-out;
    font-weight: 500;
    font-size: 14px;
}

#statusBar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 22px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    display: none;
    z-index: 100;
    animation: slideUp 0.3s ease-out;
    font-weight: 500;
    font-size: 14px;
}

.status-bar.success,
#statusBar.success { 
    border-color: var(--success); 
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.status-bar.error,
#statusBar.error { 
    border-color: var(--error); 
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.status-bar.info,
#statusBar.info { 
    border-color: var(--primary); 
    color: var(--primary);
    background: rgba(0, 123, 255, 0.1);
}

.error-message, .error { 
    color: var(--error); 
    background: rgba(239, 68, 68, 0.1); 
    border: 1px solid rgba(239, 68, 68, 0.3); 
    padding: 10px 14px; 
    border-radius: 8px;
    font-size: 14px;
    animation: shake 0.3s ease;
}

.tag { 
    display: inline-flex; 
    align-items: center; 
    padding: 6px 14px; 
    border-radius: 999px; 
    font-size: 13px; 
    font-weight: 500;
    border: 1px solid var(--border);
    margin-left: 10px;
}

.tag.success { 
    border-color: var(--success); 
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.tag.warning { 
    border-color: var(--warning); 
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.modal-toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    text-align: left;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 30;
    max-width: 300px;
}

.modal-toast h4 {
    margin-bottom: 15px;
    text-align: center;
}

.modal-toast ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-toast li {
    margin-bottom: 8px;
}

.hidden {
    display: none !important;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

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

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

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes staggerIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

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

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

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    body { padding: 12px; }
    .card { padding: 20px; }
    
    .header { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 14px;
        padding: 18px;
    }
    
    .action-bar { 
        flex-direction: column; 
        width: 100%;
    }
    
    .action-bar .btn,
    .action-bar .search-input {
        width: 100%;
    }
    
    .nav-tabs { 
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-width: 380px;
    }

    .chat-container {
        height: 400px;
    }
}
