* {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: #f4f5f7;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* =========================================
   TOP NAVIGATION
   ========================================= */
.top-nav {
    background-color: #1a237e; /* The deep corporate blue */
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #ffb300; /* Gold accent line */
}

    .top-nav h2 {
        margin: 0;
        font-size: 1.2rem;
        font-weight: 500;
        letter-spacing: 1px;
        color: white;
    }

.export-btn {
    background-color: #fff;
    color: #222;
    border: 1px solid #ccc;
    padding: 8px 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
}

    .export-btn:hover {
        background-color: #eee;
    }

/* =========================================
   MAIN APP LAYOUT
   ========================================= */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Sidebar */
.sidebar-nav {
    width: 220px;
    background-color: #ffffff;
    border-right: 1px solid #ddd;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
}

.nav-tab {
    background: none;
    border: none;
    padding: 15px 20px;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    color: #555;
    border-left: 4px solid transparent;
}

    .nav-tab:hover {
        background-color: #f0f0f0;
    }

    .nav-tab.active {
        background-color: #e8eaf6;
        border-left: 4px solid #222;
        color: #222;
        font-weight: bold;
    }

/* Middle Parameters Panel */
.parameters-panel {
    width: 350px;
    background-color: #fafafa;
    border-right: 1px solid #ddd;
    padding: 20px;
    overflow-y: auto;
}

    .parameters-panel h3 {
        margin-top: 0;
        border-bottom: 2px solid #222;
        padding-bottom: 5px;
        color: #222;
    }

/* Inputs specifically for the Sidebar */
.input-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

    .input-group label {
        font-size: 0.85rem;
        color: #333;
        margin-bottom: 4px;
        font-weight: bold;
        text-transform: uppercase;
    }

    .input-group input, .input-group select {
        padding: 8px;
        border: 1px solid #ccc;
        border-radius: 4px;
        font-size: 1rem;
    }

        .input-group select:disabled {
            background-color: #eee;
            cursor: not-allowed;
        }

/* =========================================
   DRAWING BOARD & VIEWPORTS
   ========================================= */
.drawing-board {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
    box-sizing: border-box;
}

#door-container {
    width: 66%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#profile-container {
    width: 34%;
    height: 100%;
    background: #ffffff;
    border-left: 2px solid #ccc;
    box-shadow: -2px 0 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.viewport {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 0;
    border-bottom: 2px solid #ddd;
}

    .viewport:last-child {
        border-bottom: none;
    }

    #doorCanvas, .viewport svg {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        transform: scaleY(-1); /* SVG Inversion Fix */
    }

#doorCanvas {
    background-color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 1px solid #ccc;
}

/* =========================================
   CAD STYLING (SVG Lines)
   ========================================= */
.cad-line {
    stroke: #000;
    stroke-width: 0.3;
}

.cad-text {
    font-family: monospace;
    font-size: 2px;
    fill: #000;
}

.door-part {
    fill: #fff;
    stroke: #000;
    stroke-width: 0.2;
    stroke-linejoin: round;
}

.cad-profile-line {
    fill: none;
    stroke: #555;
    stroke-width: 0.15;
    stroke-linejoin: round;
}

.molding-out {
    fill: #f4f4f4;
    stroke: #000;
    stroke-width: 0.025;
}

.profile-part {
    fill: #f4f4f4;
    stroke: #000;
    stroke-width: 0.025;
    stroke-linejoin: round;
}

.profile-molding {
    fill: #e8eaf6;
    stroke: #1a237e;
    stroke-width: 0.02;
    stroke-dasharray: 0.05, 0.05;
}

.door-glass {
    fill: #e0f7fa;
    stroke: #80deea;
    stroke-width: 0px;
}


/* =========================================
   PORTALS: ADMIN & PROJECT BROWSER
   ========================================= */
.admin-content {
    padding: 30px;
    width: 100%;
    background: white;
    box-sizing: border-box;
    overflow-y: auto;
}

.admin-header {
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .admin-header h3 {
        margin: 0;
        color: #333;
    }

    .admin-header p {
        margin: 5px 0 0 0;
        color: #666;
        font-size: 14px;
    }

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

    .data-table th, .data-table td {
        padding: 12px;
        text-align: left;
        border-bottom: 1px solid #ddd;
    }

    .data-table th {
        background-color: #f4f7f6;
        color: #333;
    }

    .data-table tr:hover {
        background-color: #f1f5f9;
        cursor: pointer;
    }


/* =========================================
   MODALS (Popups)
   ========================================= */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-box {
    background: white;
    padding: 30px;
    border-radius: 8px;
    width: 450px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

    .modal-box h3 {
        margin-top: 0;
        border-bottom: 1px solid #eee;
        padding-bottom: 10px;
        color: #333;
    }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 25px;
    gap: 10px;
}

/* Inputs specifically for Modals & Login pages */
.form-group {
    margin-bottom: 15px;
}

    .form-group label {
        display: block;
        font-weight: bold;
        margin-bottom: 5px;
        font-size: 14px;
        color: #555;
    }

    .form-group input, .form-group select {
        width: 100%;
        padding: 10px;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-sizing: border-box;
    }

/* =========================================
   GLOBAL BUTTONS
   ========================================= */
.btn-save {
    background: #0056b3;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    font-weight: bold;
}

    .btn-save:hover {
        background: #004494;
    }

.btn-approve {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    font-weight: bold;
}

    .btn-approve:hover {
        background: #218838;
    }

.btn-deny {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    font-weight: bold;
}

    .btn-deny:hover {
        background: #c82333;
    }

.btn-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    font-weight: bold;
}

    .btn-cancel:hover {
        background: #5a6268;
    }

/* Modal Toggle Tabs */
.btn-tab-active {
    background: #0056b3;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    font-weight: bold;
}

.btn-tab-inactive {
    background: #e9ecef;
    color: #555;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
}


/* =========================================
   AUTH PAGES (Login & Register)
   ========================================= */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100%;
    background-color: #f4f5f7;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

    .auth-box h2 {
        margin-top: 0;
        color: #333;
        text-align: center;
        margin-bottom: 20px;
    }

.auth-btn {
    width: 100%;
    background: #1a237e;
    color: white;
    border: none;
    padding: 12px;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: bold;
}

    .auth-btn:hover {
        background: #12185b;
    }

.auth-link {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9rem;
}

    .auth-link a {
        color: #1a237e;
        text-decoration: none;
        font-weight: bold;
    }

.error-msg {
    color: #dc3545;
    font-size: 0.9rem;
    margin-bottom: 15px;
    text-align: center;
    min-height: 20px;
    font-weight: bold;
}

/* High-Priority Call-To-Action Button */
.btn-cta {
    background: #28a745; /* Vibrant Green */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

    .btn-cta:hover {
        background: #218838;
    }