/* Global Variables - Dark Glassmorphism Theme */
:root {
    --bg-dark: #0f172a; /* Slate 900 */
    --bg-glass: rgba(30, 41, 59, 0.6); /* Slate 800 transparent */
    --border-glass: rgba(255, 255, 255, 0.1);
    
    --primary-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6); /* Blue to Purple */
    --primary-color: #3b82f6; 
    --primary-hover: #2563eb;
    
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    
    --text-main: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    
    --shadow-soft: 0 4px 30px rgba(0, 0, 0, 0.5);
    --radius-lg: 16px;
    --radius-md: 8px;
    
    --font-family: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.15), transparent 40%),
                      radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.15), transparent 40%);
    overflow: hidden; /* Prevent body scroll if possible, manage in app-container */
}

/* App Container Layout */
.app-container {
    display: flex;
    width: 95vw;
    height: 95vh;
    max-width: 1400px;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

/* Glass Panel Utility */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
}

/* Sidebar */
.sidebar {
    width: 250px;
    border-right: 1px solid var(--border-glass);
    border-radius: 0; /* Override */
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 3rem;
    padding-left: 10px;
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo span {
    font-weight: 300;
}

.glow-icon {
    font-size: 1.8rem;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-links li {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
    color: var(--text-muted);
}

.nav-links li i {
    font-size: 1.2rem;
}

.nav-links li:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}

.nav-links li.active {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    overflow-y: auto;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.top-nav h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.date-display {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    border: 1px solid var(--border-glass);
}

/* Views System */
.view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view.active-view {
    display: block;
}

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

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 3rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: var(--accent-purple); border-color: rgba(139, 92, 246, 0.3); }
.stat-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); border-color: rgba(16, 185, 129, 0.3); }

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    font-weight: 400;
}

.stat-info p {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Section Actions */
.header-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-action h2, .section-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Buttons */
button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

/* Forms */
.form-container {
    padding: 2rem;
    margin-bottom: 2rem;
}

.form-container.hidden {
    display: none;
}

.form-container h3 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.input-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-group input, 
.input-group select, 
.input-group textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    padding: 12px 15px;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease;
}

.input-group select option {
    background-color: var(--bg-dark);
    color: var(--text-main);
}

.input-group input:focus, 
.input-group select:focus, 
.input-group textarea:focus {
    border-color: var(--primary-color);
}

/* Chrome/Safari bugfix for dark datetime pickers */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 15px;
}

.btn-submit {
    background: var(--accent-green);
    color: white;
    padding: 10px 25px;
}

.btn-submit:hover {
    background: #059669;
}

.btn-cancel {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-glass);
    padding: 10px 20px;
}

.btn-cancel:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

/* Lists and Cards */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.customer-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.customer-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--primary-gradient);
}

.card-header h4 { font-size: 1.1rem; }
.card-company { font-size: 0.8rem; color: var(--primary-color); margin-bottom: 8px;}
.card-detail { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 0.9rem; }

/* Timeline for Calls */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.call-item {
    display: flex;
    gap: 20px;
    padding: 1.5rem;
    border-left: 3px solid var(--accent-purple);
}

.call-date {
    min-width: 120px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.call-content h4 {
    margin-bottom: 8px;
    color: var(--text-main);
}

.call-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.btn-read-more {
    background: none;
    color: var(--primary-color);
    padding: 0;
    font-size: 0.9rem;
    margin-top: 10px;
}
.btn-read-more:hover { text-decoration: underline; }

/* Dashboard Reminders */
.reminders-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.reminder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
}

.reminder-item.upcoming {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.reminder-info h4 { margin-bottom: 5px; }
.reminder-info p { font-size: 0.85rem; color: var(--text-muted); }

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}
.modal.hidden { display: none; }

.modal-content {
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    position: relative;
    animation: scaleIn 0.3s ease forwards;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close-modal {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-modal:hover { color: white; }

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-glass);
}

/* -------------------------------------
   RESPONSIVE DESIGN (Mobile / Tablet)
   ------------------------------------- */
@media (max-width: 768px) {
    /* Full screen container */
    .app-container {
        width: 100vw;
        height: 100dvh; /* Better than 100vh for iOS Safari */
        max-width: none;
        border-radius: 0;
        border: none;
        flex-direction: column;
    }

    /* Tweak Sidebar */
    .sidebar {
        width: 100%;
        padding: 10px;
        flex-direction: column;
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
    }

    /* Logo Center */
    .logo {
        margin-bottom: 1rem;
        justify-content: center;
        padding-left: 0;
    }

    /* Horizontal Nav Tabs */
    .nav-links {
        flex-direction: row;
        justify-content: space-between;
        gap: 5px;
    }
    
    .nav-links li {
        padding: 10px;
        flex: 1;
        justify-content: center;
        flex-direction: column; /* Icon above text */
        gap: 5px;
        text-align: center;
    }

    .nav-links li span {
        font-size: 0.70rem;
    }

    .nav-links li i {
        font-size: 1.4rem;
    }

    /* Bottom Action Buttons -> Horizontal */
    .sidebar > div[style*="margin-top: auto"] {
        margin-top: 10px !important;
        display: flex;
        flex-direction: row;
        gap: 5px;
        padding-top: 10px;
    }
    
    .sidebar > div[style*="margin-top: auto"] button {
        flex: 1;
        font-size: 0; /* hide raw text */
        margin-bottom: 0 !important;
        padding: 10px;
    }
    
    .sidebar > div[style*="margin-top: auto"] button span {
        display: none; /* explicitly hide text */
    }

    .sidebar > div[style*="margin-top: auto"] button i {
        font-size: 1.5rem;
    }
    
    .sidebar > div[style*="margin-top: auto"] p {
        display: none; /* hide panic text info on mobile */
    }

    /* Main Area tweaks */
    .main-content {
        padding: 1rem;
    }
    
    .top-nav {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        margin-bottom: 1rem;
    }
    
    .top-nav h1 {
        font-size: 1.3rem;
    }
    
    /* Header action & button layouts */
    .header-action {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* Dashboard cards */
    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    /* Tables/Cards */
    .data-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
    }

    /* Reminder Cards Mobile Fix */
    .reminder-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .reminder-item button {
        width: 100%;
        justify-content: center;
    }

    /* Call Item Mobile Fix */
    .call-item {
        flex-direction: column;
        gap: 10px;
    }
}
