/* Google Fonts - Plus Jakarta Sans */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #0d5e30; /* NU Green */
    --primary-hover: #083c1e;
    --primary-light: #eaf6ee; /* Active menu highlight */
    
    --bg-main: #f5f7fa; /* Clean light grey-green background */
    --bg-card: #ffffff;
    --border-color: #f1f4f2;
    
    --text-main: #1e2925;
    --text-muted: #88988e;
    --text-white: #ffffff;
    
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 40px rgba(6, 40, 21, 0.05);
    
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Auth / Login Page */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at 10% 20%, #eaf6ee 0%, #f5f7fa 100%);
    position: relative;
}

.auth-card {
    background: var(--bg-card);
    padding: 50px 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    text-align: center;
    border: 1px solid rgba(13, 94, 48, 0.05);
}

.auth-logo {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 35px;
}

/* Premium Forms */
.form-group {
    margin-bottom: 24px;
    text-align: left;
}

.form-label {
    display: block;
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 8px;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background-color: #f8fafc;
    color: var(--text-main);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(13, 94, 48, 0.1);
}

/* Buttons in reference dashboard (pills / rounded) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 12px 24px;
    border-radius: 50px; /* Pill shape like reference */
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-white);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(13, 94, 48, 0.15);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

.btn-danger:hover {
    background-color: #fca5a5;
    color: #7f1d1d;
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--success-light);
    color: #065f46;
}

.btn-success:hover {
    background-color: #a7f3d0;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

/* Alert styles */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    display: flex;
    align-items: center;
    border: 1px solid transparent;
}

.alert-danger {
    background-color: var(--danger-light);
    color: #991b1b;
    border-color: #fee2e2;
}

.alert-success {
    background-color: var(--success-light);
    color: #065f46;
    border-color: #d1fae5;
}

/* Main Layout (Reference Layout: White Sidebar + Light Grey-Green Content) */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - Clean White with Pill Nav Links */
.sidebar {
    width: 280px;
    background-color: #ffffff;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
    border-right: 1.5px solid var(--border-color);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 35px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo svg {
    /* Stroke is handled inline to allow white icons inside green circles */
}

.sidebar-logo span {
    font-size: 1.35rem;
    letter-spacing: -0.5px;
}

.sidebar-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px 0 10px 15px;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    color: #55695c;
    text-decoration: none;
    border-radius: 50px; /* Pill Shape */
    font-weight: 600;
    font-size: 0.92rem;
    transition: var(--transition);
}

.sidebar-link svg {
    stroke: #55695c;
    transition: var(--transition);
}

.sidebar-link:hover {
    color: var(--primary);
    background-color: #f7faf8;
}

.sidebar-link.active {
    color: var(--primary);
    background-color: var(--primary-light);
    font-weight: 700;
}

.sidebar-link.active svg {
    stroke: var(--primary);
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1.5px solid var(--border-color);
    padding-top: 20px;
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 40px;
    width: calc(100% - 280px);
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background-color: #ffffff;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    padding: 6px 16px;
    border-radius: 50px;
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    cursor: pointer;
    user-select: none;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
}

/* Profile Dropdown */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    display: none;
    flex-direction: column;
    z-index: 1000;
}

.profile-dropdown.show {
    display: flex;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 6px 0;
}

/* Dashboard Cards (White Rounded Cards with Soft Shadows) */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.dashboard-card {
    background-color: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.card-info h3 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
}

.card-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

/* Content Panel Cards */
.content-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 35px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Tables styling (Beautiful clean margins, subtle separators) */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    padding: 16px;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1.5px solid var(--border-color);
}

.custom-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.95rem;
}

.custom-table tr:hover td {
    background-color: #fafbfc;
}

.student-img-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-primary {
    background-color: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background-color: var(--success-light);
    color: #065f46;
}

/* Designer Drag & Drop Interface */
.designer-container {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 30px;
    align-items: start;
    width: 100%;
}

.designer-tools {
    background-color: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.tool-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1.5px solid var(--border-color);
}

.tool-section:last-child {
    border-bottom: none;
}

.tool-title {
    font-weight: 800;
    font-size: 0.82rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.designer-workspace {
    display: flex;
    flex-direction: column;
    gap: 35px;
    align-items: center;
    background-color: #f1f5f9;
    padding: 40px;
    border-radius: var(--radius-md);
    border: 1.5px dashed #cbd5e1;
    overflow: auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.card-canvas {
    position: relative;
    width: 539.8px; 
    height: 339.8px;
    background-color: #ffffff;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: 0 15px 35px rgba(0,0,0,0.08);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

/* Faint dashed green grid overlay for alignment check */
.card-canvas.show-grid::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1; /* Above background image but below draggable elements */
    background-image: 
        /* Vertical center line (thicker, solid) */
        linear-gradient(to right, rgba(13, 94, 48, 0.45) 1.5px, transparent 1.5px),
        /* Horizontal center line (thicker, solid) */
        linear-gradient(to bottom, rgba(13, 94, 48, 0.45) 1.5px, transparent 1.5px),
        /* Dashed background grid */
        url("data:image/svg+xml,%3Csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='grid' width='20' height='20' patternUnits='userSpaceOnUse'%3E%3Cpath d='M 20 0 L 0 0 0 20' fill='none' stroke='rgba(13, 94, 48, 0.12)' stroke-width='1' stroke-dasharray='3,3'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23grid)'/%3E%3C/svg%3E");
    background-position: center center, center center, left top;
    background-repeat: no-repeat, no-repeat, repeat;
    background-size: 1.5px 100%, 100% 1.5px, auto;
}

.card-element {
    position: absolute;
    cursor: move;
    user-select: none;
    padding: 2px 5px;
    border: 1px dashed transparent;
    display: flex;
    align-items: center;
    border-radius: 4px;
    z-index: 2; /* Always above grid overlay */
}

.card-element:hover, .card-element.active {
    border-color: var(--primary);
    background-color: rgba(13, 94, 48, 0.05);
}

.card-element.active::after {
    content: "";
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    pointer-events: none;
    background-image: 
        /* 4 Corners */
        radial-gradient(circle, var(--primary) 2.5px, #ffffff 2.5px, #ffffff 4px, transparent 4px),
        radial-gradient(circle, var(--primary) 2.5px, #ffffff 2.5px, #ffffff 4px, transparent 4px),
        radial-gradient(circle, var(--primary) 2.5px, #ffffff 2.5px, #ffffff 4px, transparent 4px),
        radial-gradient(circle, var(--primary) 2.5px, #ffffff 2.5px, #ffffff 4px, transparent 4px),
        /* 4 Centers */
        radial-gradient(circle, var(--primary) 2.5px, #ffffff 2.5px, #ffffff 4px, transparent 4px),
        radial-gradient(circle, var(--primary) 2.5px, #ffffff 2.5px, #ffffff 4px, transparent 4px),
        radial-gradient(circle, var(--primary) 2.5px, #ffffff 2.5px, #ffffff 4px, transparent 4px),
        radial-gradient(circle, var(--primary) 2.5px, #ffffff 2.5px, #ffffff 4px, transparent 4px);
    background-position: 
        /* 4 Corners */
        left 0.5px top 0.5px,
        right 0.5px top 0.5px,
        left 0.5px bottom 0.5px,
        right 0.5px bottom 0.5px,
        /* 4 Centers */
        center top 0.5px,
        center bottom 0.5px,
        left 0.5px center,
        right 0.5px center;
    background-size: 9px 9px;
    background-repeat: no-repeat;
    z-index: 3;
}

.element-text {
    font-weight: 700;
    color: #000;
    white-space: pre-wrap;
}

.element-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Webcam Container */
.webcam-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.webcam-feed {
    width: 100%;
    max-width: 400px;
    height: 300px;
    background-color: #000;
    border-radius: var(--radius-sm);
    transform: scaleX(-1);
    box-shadow: var(--shadow-sm);
}

.webcam-preview-canvas {
    display: none;
}

/* Responsive styles */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 30px 10px;
    }
    
    .sidebar-logo span, .sidebar-link span, .sidebar-section-title {
        display: none;
    }
    
    .sidebar-logo {
        justify-content: center;
        margin-bottom: 30px;
    }
    
    .sidebar-link {
        justify-content: center;
        padding: 12px;
    }
    
    .main-content {
        margin-left: 80px;
        width: calc(100% - 80px);
        padding: 25px;
    }

    .designer-container {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .designer-workspace {
        padding: 20px 10px;
    }
    
    .content-card {
        padding: 20px;
    }
}

/* Modals style */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(30, 41, 37, 0.4);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}
.modal.show {
    display: flex;
    opacity: 1;
}
.modal-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    margin: 20px;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
}
.modal.show .modal-content {
    transform: scale(1);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1.5px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-main);
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.modal-close:hover {
    background-color: var(--border-color);
    color: var(--danger);
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1.5px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

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