﻿/* ==============================================
   1. VARIABLES AND THEME SETTINGS
============================================== */

:root {
    --bg-primary: #F5F8FA;
    --bg-card: #FFFFFF;
    --gradient-primary: linear-gradient(135deg, #7DCCBD, #6D8E96);
    --gradient-hover: linear-gradient(135deg, #6D8E96, #B8E2DC);
    --text-primary: #1C2B38;
    --text-secondary: #2a3b48;
    --border: #6D8E96;
    --input-bg: #FFFFFF;
    --success: #7DCCBD;
    --error: #e74c3c;
}

/* Dark Theme */
.theme-dark {
    --bg-primary: #1C2B38;
    --bg-card: #2a3b48;
    --gradient-primary: linear-gradient(135deg, #7DCCBD, #6D8E96);
    --gradient-hover: linear-gradient(135deg, #6D8E96, #1C2B38);
    --text-primary: #7DCCBD;
    --text-secondary: #B8E2DC;
    --border: #6D8E96;
    --input-bg: #243442;
    --success: #7DCCBD;
    --error: #e74c3c;
}

/* Light Theme */
.theme-light {
    --bg-primary: #F5F8FA;
    --bg-card: #FFFFFF;
    --gradient-primary: linear-gradient(135deg, #7DCCBD, #6D8E96);
    --gradient-hover: linear-gradient(135deg, #6D8E96, #B8E2DC);
    --text-primary: #1C2B38;
    --text-secondary: #2a3b48;
    --border: #6D8E96;
    --input-bg: #FFFFFF;
    --success: #7DCCBD;
    --error: #e74c3c;
}

/* ==============================================
   2. BASE STYLES
============================================== */

/* Grundlæggende styling */
body {
    font-family: system-ui, -apple-system, sans-serif;
    margin: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Container og kort */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Button base styles */
button, .btn, .btn-primary, .primary-button {
    width: auto !important;
    min-width: 120px;
    max-width: 200px;
    padding-left: 20px;
    padding-right: 20px;
}

/* ==============================================
   3. LOGIN SCREEN
============================================== */

/* Center the login box */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 30px;
    width: 100%;
    max-width: 400px;
}

.login-container .card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ==============================================
   4. DASHBOARD LAYOUT
============================================== */

.dashboard-container {
    display: block;
    width: 100%;
    padding: 0;
}

    .dashboard-container.hidden {
        display: none;
    }

.top-section {
    margin: 0;
    padding: 1rem;
    width: 100%;
    display: block;
}

    .top-section .card {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

.sub-section {
    display: block;
}

.card {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 2rem;
    box-sizing: border-box;
    margin-bottom: 2rem; /* Increase margin between cards */
}

/* ==============================================
   5. TYPOGRAPHY
============================================== */

/* Overskrifter */
h1 {
    font-size: 2.5rem;
    margin: 0 0 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Section titles */
.section-title {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    font-weight: bold;
}

/* ==============================================
   6. FORMS AND INPUTS
============================================== */

/* Formular- og grid-styling */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    max-width: 300px;
}

    .input-group label {
        margin-bottom: 0.5rem;
        color: var(--text-secondary);
    }

/* Input & Select */
input, select {
    width: 100%;
    padding: 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    transition: all 0.2s;
    box-sizing: border-box;
}

    input:focus, select:focus {
        outline: none;
        border-color: var(--text-secondary);
        box-shadow: 0 0 0 3px rgba(125,204,189,0.2);
    }

.full-width {
    grid-column: 1 / -1;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    transition: all 0.2s;
    min-height: 100px;
    resize: vertical;
    box-sizing: border-box;
}

    textarea:focus {
        outline: none;
        border-color: var(--text-secondary);
        box-shadow: 0 0 0 3px rgba(125,204,189,0.2);
    }

/* ==============================================
   7. BUTTON STYLES
============================================== */

button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-button {
    background: var(--gradient-primary);
    color: var(--text-primary);
}

    .primary-button:hover {
        background: var(--gradient-hover);
        transform: translateY(-1px);
    }

.secondary-button {
    background: var(--border);
    color: #fff;
}

    .secondary-button:hover {
        background: var(--gradient-hover);
    }

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* ==============================================
   8. SIDEBAR STYLING
============================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background: #2a3b48;
    color: #fff;
    padding: 1rem;
    z-index: 1000;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 1rem 0 0 1rem;
}

/* Improved logo container and toggle button positioning */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 1.5rem;
}

.favicon-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

.logo-text {
    color: #ffffff !important; /* Keep logo text color consistent */
    transition: opacity 0.3s ease;
    font-weight: bold;
}

.toggle-sidebar {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    width: auto !important;
    min-width: auto !important;
}

.menu {
    margin-top: 2rem;
    flex-grow: 1;
}

.menu-item {
    padding: 0.75rem;
    margin-bottom: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

    .menu-item:hover {
        background-color: rgba(125, 204, 189, 0.1);
    }

    .menu-item.active {
        background: var(--gradient-primary);
        border-radius: 0.5rem;
    }

.menu-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
}

.menu-text {
    font-weight: 500;
}

.sidebar-bottom {
    position: static;
    bottom: auto;
    left: auto;
    width: calc(100% - 2rem);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: width 0.3s ease;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    padding: 1rem;
    padding-right: 1rem;
    padding-bottom: 1.5rem;
    padding-top: 10px;
}

/* Button row for theme toggle and download */
.button-row {
    display: flex;
    width: 100%;
    gap: 5px;
    margin-bottom: 0.75rem;
}

.theme-toggle {
    width: 25% !important;
    background: var(--gradient-primary);
    color: var(--text-primary);
    border: none;
    border-radius: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 0 !important;
    min-width: unset !important;
    max-width: unset !important;
}

    .theme-toggle:hover {
        filter: brightness(90%);
        transform: translateY(-1px);
    }

.theme-icon {
    font-size: 1.2rem;
}

/* Download button */
.download-button {
    width: 75% !important;
    background: var(--success);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 0 !important;
    min-width: unset !important;
    max-width: unset !important;
    cursor: pointer;
}

    .download-button:hover {
        filter: brightness(90%);
        transform: translateY(-1px);
    }

/* Logout button */
#logoutButton {
    width: 100% !important;
    background: var(--error);
    color: white;
    padding: 0.75rem 0 !important;
    border-radius: 0.5rem;
    min-width: unset !important;
    max-width: unset !important;
    margin-bottom: 0.5rem;
}

    #logoutButton:hover {
        filter: brightness(90%);
    }

/* ==============================================
   9. SIDEBAR COLLAPSED STATE
============================================== */

.sidebar.collapsed {
    width: 60px;
}

    .sidebar.collapsed .menu-text {
        display: none;
    }

    .sidebar.collapsed .logo {
        justify-content: center;
        width: 100%;
    }

    .sidebar.collapsed .logo-text {
        display: none;
        opacity: 0;
    }

    .sidebar.collapsed .favicon-icon {
        margin: 0 auto;
    }

    /* Adjust toggle button position when sidebar is collapsed */
    .sidebar.collapsed .toggle-sidebar {
        right: 5px;
    }

    /* Collapsed sidebar styles for bottom section */
    .sidebar.collapsed .sidebar-bottom {
        position: static;
        margin-top: auto;
        padding: 1rem 0.5rem 1.5rem;
        width: calc(100% - 1rem);
    }

    .sidebar.collapsed .button-row {
        margin-bottom: 0.75rem;
        justify-content: center;
    }

    .sidebar.collapsed .theme-toggle {
        width: 100% !important;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .sidebar.collapsed .download-button {
        display: none;
    }

    .sidebar.collapsed #logoutButton {
        min-width: 40px !important;
        width: 100% !important;
        padding: 0.75rem 0 !important;
        overflow: hidden;
        text-indent: -9999px;
        position: relative;
        margin-bottom: 0.5rem;
    }

        .sidebar.collapsed #logoutButton::after {
            content: "👋";
            position: absolute;
            left: 0;
            right: 0;
            text-align: center;
            text-indent: 0;
        }

/* ==============================================
   10. CONTENT AREA
============================================== */

.content {
    margin-left: 250px;
    padding: 2.5rem;
    width: calc(100% - 250px);
    max-width: none;
    box-sizing: border-box;
    transition: margin-left 0.3s, width 0.3s;
}

.sidebar.collapsed + .content.with-sidebar {
    margin-left: 60px;
    width: calc(100% - 60px);
}

.header {
    width: 100%;
    text-align: center;
    margin-bottom: 2rem;
}

.header-buttons {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

    .header-buttons button {
        margin-left: 1rem;
    }

/* ==============================================
   11. TABLE STYLING
============================================== */

/* Tabel */
.table-container {
    overflow-x: auto;
    padding: 0.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-secondary);
    font-weight: 500;
}

tr:hover {
    background: rgba(125,204,189,0.1);
}

/* ==============================================
   12. TOOLTIP STYLING
============================================== */

/* Tooltip */
.tooltip-label {
    position: relative;
    cursor: help;
}

    .tooltip-label::before {
        content: attr(data-tooltip);
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        padding: 0.5rem 1rem;
        background: var(--bg-card);
        color: var(--text-primary);
        border: 1px solid var(--border);
        border-radius: 0.5rem;
        font-size: 0.875rem;
        max-width: 90vw;
        opacity: 0;
        visibility: hidden;
        transition: all 0.2s ease;
        z-index: 1000;
    }

    .tooltip-label:hover::before {
        opacity: 1;
        visibility: visible;
        bottom: calc(100% + 5px);
    }

/* ==============================================
   13. CHECKBOX STYLING
============================================== */

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .checkbox-group input[type="checkbox"] {
        width: 1.125rem;
        height: 1.125rem;
        border-radius: 0.25rem;
        border: 2px solid var(--border);
        background: var(--input-bg);
        cursor: pointer;
        appearance: none;
        position: relative;
    }

        .checkbox-group input[type="checkbox"]:checked {
            background: var(--gradient-primary);
            border: none;
        }

            .checkbox-group input[type="checkbox"]:checked::after {
                content: "✓";
                position: absolute;
                color: white;
                font-size: 0.75rem;
                left: 50%;
                top: 50%;
                transform: translate(-50%, -50%);
            }

/* ==============================================
   14. SEARCH STYLING
============================================== */

.search-container {
    margin-bottom: 1rem;
}

.search-input {
    width: 100%;
    max-width: 300px;
    padding: 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

    .search-input:focus {
        outline: none;
        border-color: var(--text-secondary);
        box-shadow: 0 0 0 3px rgba(125,204,189,0.2);
    }

/* ==============================================
   15. ADVANCED SETTINGS TOGGLE
============================================== */

/* Avancerede indstillinger toggle */
.advanced-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

    .advanced-toggle:hover {
        background: rgba(125,204,189,0.1);
        transform: none;
    }

/* ==============================================
   16. MODAL STYLING
============================================== */

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

    .modal.show {
        display: flex;
        justify-content: center;
        align-items: center;
    }

.modal-content {
    background-color: var(--bg-card);
    margin: auto;
    padding: 2rem;
    border-radius: 0.5rem;
    width: 80%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-secondary);
}

    .close-modal:hover {
        color: var(--text-primary);
    }

/* ==============================================
   17. PHONEBOOK SPECIFIC STYLES
============================================== */

/* Phonebook specific styles */
.favorite-star {
    color: #FFD700;
    cursor: pointer;
    font-size: 1.2rem;
}

.star-inactive {
    color: var(--text-secondary);
    opacity: 0.3;
}

.presence-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.presence-online {
    background-color: #2ecc71;
}

.presence-offline {
    background-color: #95a5a6;
}

.button-container {
    display: flex;
    gap: 0.5rem;
}

/* Button that looks like a phone icon */
.call-button {
    background: var(--success);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

    .call-button:hover {
        transform: scale(1.1);
        background: var(--gradient-hover);
    }

/* ==============================================
   18. UTILITY CLASSES
============================================== */

/* Skjul klassedefinition */
.hidden {
    display: none !important;
}

/* ==============================================
   19. RESPONSIVE STYLES
============================================== */

/* Small screens */
@media (max-width: 480px) {
    .login-container .card {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }
}

/* Medium screens */
@media (max-width: 768px) {
    .content.with-sidebar {
        margin-left: 60px;
        width: calc(100% - 60px);
    }

    .sidebar {
        width: 60px;
    }

        .sidebar .menu-text {
            display: none;
        }

        .sidebar .logo {
            display: flex;
            font-size: 1.2rem;
            justify-content: center;
        }

            .sidebar .logo::before {
                content: "M";
                display: block;
            }

    .sidebar-bottom {
        width: calc(60px - 2rem);
        align-items: center;
    }

        .sidebar-bottom button {
            min-width: 40px;
            width: 40px !important;
            padding: 0.75rem 0;
        }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large screens */
@media (max-width: 1200px) {
    .form-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
