/* AD Management Tool - Modern Design */
/* Color Scheme: Black, White, Grey */

:root {
    --primary-black: #000000;
    --primary-white: #ffffff;
    --light-grey: #f5f5f5;
    --medium-grey: #e0e0e0;
    --dark-grey: #333333;
    --border-grey: #d0d0d0;
    --text-grey: #666666;
    --success-green: #28a745;
    --danger-red: #dc3545;
    --warning-yellow: #ffc107;
    --info-blue: #17a2b8;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --shadow-dark: rgba(0, 0, 0, 0.25);
}

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

/* Ensure consistent font family across all elements */
button,
input,
select,
textarea,
.btn,
.form-control {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Global rule to remove underlines from all buttons and button-like elements */
button,
.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-icon,
.btn-logout,
.btn-sm,
[type="button"],
[type="submit"],
[type="reset"] {
    text-decoration: none !important;
}

button:hover,
.btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-success:hover,
.btn-danger:hover,
.btn-warning:hover,
.btn-icon:hover,
.btn-logout:hover,
.btn-sm:hover {
    text-decoration: none !important;
}

a.btn,
a.btn-primary,
a.btn-secondary,
a.btn-success,
a.btn-danger,
a.btn-warning,
a.btn-icon,
a.btn-sm {
    text-decoration: none !important;
}

a.btn:hover,
a.btn-primary:hover,
a.btn-secondary:hover,
a.btn-success:hover,
a.btn-danger:hover,
a.btn-warning:hover,
a.btn-icon:hover,
a.btn-sm:hover {
    text-decoration: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--dark-grey);
    background-color: var(--light-grey);
    min-height: 100vh;
}

/* Header */
.header {
    background-color: var(--primary-white);
    border-bottom: 2px solid var(--primary-black);
    box-shadow: 0 2px 4px var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
}

.logo-text {
    height: 30px;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-black);
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--medium-grey);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.username {
    color: var(--dark-grey);
    font-weight: 500;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.user-profile:hover {
    background-color: var(--light-grey);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-white);
    box-shadow: 0 2px 4px var(--shadow-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.user-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--medium-grey) 0%, var(--light-grey) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-grey);
    border: 2px solid var(--primary-white);
    box-shadow: 0 2px 4px var(--shadow-light);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 600;
    color: var(--primary-black);
    font-size: 0.95rem;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-grey);
    line-height: 1.2;
}

.user-dropdown {
    position: relative;
}

.user-menu-toggle {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--dark-grey);
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu-toggle:hover {
    background-color: var(--light-grey);
    color: var(--primary-black);
}

.user-menu-toggle.active {
    background-color: var(--primary-black);
    color: var(--primary-white);
}

.user-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background-color: var(--primary-white);
    border: 1px solid var(--border-grey);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-medium);
    min-width: 250px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.user-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    padding: 1rem;
    background-color: var(--light-grey);
    border-radius: 8px 8px 0 0;
}

.user-menu-name {
    font-weight: 600;
    color: var(--primary-black);
    margin-bottom: 0.25rem;
}

.user-menu-email {
    font-size: 0.875rem;
    color: var(--text-grey);
}

.user-menu-divider {
    height: 1px;
    background-color: var(--border-grey);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--dark-grey);
    text-decoration: none;
    transition: all 0.3s ease;
}

.user-menu-item:hover {
    background-color: var(--light-grey);
    color: var(--primary-black);
}

.user-menu-item:last-child {
    border-radius: 0 0 8px 8px;
}

.btn-logout {
    background-color: var(--primary-black);
    color: var(--primary-white);
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background-color: var(--dark-grey);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow-medium);
}

/* Main Layout */
.main-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
}

/* Sidebar Navigation */
.sidebar {
    width: 250px;
    background-color: var(--primary-white);
    border-right: 1px solid var(--border-grey);
    padding: 2rem 0;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--dark-grey);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    background-color: var(--light-grey);
    color: var(--primary-black);
}

.nav-link.active {
    background-color: var(--primary-black);
    color: var(--primary-white);
}

.nav-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
}

/* Content Area */
.content {
    flex: 1;
    padding: 2rem;
    background-color: var(--light-grey);
}

.content-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--primary-black);
    margin-bottom: 0.5rem;
}

.page-description {
    color: var(--text-grey);
}

/* Cards */
.card {
    background-color: var(--primary-white);
    border-radius: 8px;
    box-shadow: 0 1px 3px var(--shadow-light);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header {
    background-color: var(--primary-black);
    color: var(--primary-white);
    padding: 1rem 1.5rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-grey);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-red);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-grey);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: var(--primary-white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-black);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.form-control:disabled {
    background-color: var(--light-grey);
    cursor: not-allowed;
}

.form-text {
    font-size: 0.875rem;
    color: var(--text-grey);
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none !important;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-black);
    color: var(--primary-white);
    text-decoration: none !important;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--dark-grey);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow-medium);
    text-decoration: none !important;
}

.btn-secondary {
    background-color: var(--primary-white);
    color: var(--primary-black);
    border: 2px solid var(--primary-black);
    text-decoration: none !important;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--primary-black);
    color: var(--primary-white);
    text-decoration: none !important;
}

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

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

.btn-warning {
    background-color: var(--warning-yellow);
    color: var(--primary-black);
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background-color: var(--primary-black);
    color: var(--primary-white);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-grey);
}

.table tbody tr {
    transition: background-color 0.3s ease;
}

.table tbody tr:hover {
    background-color: var(--light-grey);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 0.5rem;
    background: none;
    border: 1px solid var(--border-grey);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: var(--primary-black);
    color: var(--primary-white);
    border-color: var(--primary-black);
    text-decoration: none !important;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-active {
    background-color: var(--success-green);
    color: var(--primary-white);
}

.badge-disabled {
    background-color: var(--danger-red);
    color: var(--primary-white);
}

.badge-pending {
    background-color: var(--warning-yellow);
    color: var(--primary-black);
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    border-left: 4px solid var(--success-green);
    color: var(--success-green);
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    border-left: 4px solid var(--danger-red);
    color: var(--danger-red);
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 4px solid var(--warning-yellow);
    color: var(--warning-yellow);
}

.alert-info {
    background-color: rgba(23, 162, 184, 0.1);
    border-left: 4px solid var(--info-blue);
    color: var(--info-blue);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--primary-white);
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 6px var(--shadow-dark);
}

.modal-header {
    background-color: var(--primary-black);
    color: var(--primary-white);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--primary-white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background-color: var(--light-grey);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Search Box */
.search-box {
    position: relative;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border-grey);
    border-radius: 4px;
    font-size: 14px;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-grey);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--medium-grey);
    border-top-color: var(--primary-black);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--light-grey) 0%, var(--primary-white) 100%);
}

.login-card {
    background-color: var(--primary-white);
    border-radius: 8px;
    box-shadow: 0 4px 6px var(--shadow-medium);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.login-header {
    background-color: var(--primary-black);
    color: var(--primary-white);
    padding: 2rem;
    text-align: center;
}

.login-logo {
    width: 150px;
    margin-bottom: 1rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-body {
    padding: 2rem;
}

.login-footer {
    padding: 1rem 2rem;
    background-color: var(--light-grey);
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-grey);
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-grey);
    }
    
    .header-content {
        padding: 1rem;
    }
    
    .content {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .user-profile {
        padding: 0.25rem;
    }
    
    .user-avatar,
    .user-avatar-placeholder {
        width: 35px;
        height: 35px;
    }
    
    .user-info {
        display: none;
    }
    
    .user-menu {
        right: -1rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

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

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

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success-green);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--success-green);
}

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

/* Disabled state */
.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}
