/* 
 * Unified Design System for Admin Portal
 * This file contains standardized styles and components for consistent UI/UX
 */

/* === PAGE HEADER STYLES === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.page-header h1 {
    margin-bottom: 0.25rem;
    font-size: 2rem;
    font-weight: 600;
    color: #2c3e50;
}

.page-header .text-muted {
    font-size: 1rem;
    color: #6c757d;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

.action-buttons .btn {
    min-width: 80px;
    padding: 0.5rem 1rem;
}

/* === CONTENT SECTIONS === */
.content-sections {
    max-width: 100%;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

/* === APPLICATION GRID === */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.app-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.15s ease-in-out;
}

.app-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #ced4da;
}

.app-info .app-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.app-info .app-display {
    font-size: 0.9rem;
    color: #6c757d;
}

.app-actions {
    margin: 0;
}

/* === ADD APPLICATION === */
.add-app-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    overflow: hidden;
    margin-top: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.add-app-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #e9ecef;
}

.add-app-header h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.add-app-header p {
    font-size: 0.9rem;
    margin: 0;
}

.add-app-form {
    padding: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: end;
}

.select-wrapper {
    flex: 1;
}

.select-wrapper .form-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 0.95rem;
    transition: all 0.15s ease-in-out;
}

.select-wrapper .form-select:focus {
    border-color: #6c757d;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.25);
}

.add-app-form .btn {
    min-width: 100px;
    padding: 0.6rem 1.5rem;
    white-space: nowrap;
}

/* Application Role Management */
.app-role-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
}

.app-role-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #d0d7de;
}

.app-role-header {
    display: flex;
    justify-content: between;
    align-items: start;
    margin-bottom: 1rem;
}

.app-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
}

.app-description {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.4;
}

.role-assignment-form .input-group {
    max-width: 300px;
}

.empty-state-sm {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-size: 0.875rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

/* Organization Cards in Application Details */
.organization-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    height: 100%;
    transition: all 0.2s ease;
}

.organization-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #d0d7de;
}

.organization-header {
    margin-bottom: 0.75rem;
}

.organization-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
}

.organization-actions {
    margin-top: auto;
}

/* Help Content Styling */
.help-content h5 {
    color: #1f2937;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.help-content .list-unstyled li {
    display: flex;
    align-items: flex-start;
    line-height: 1.4;
}

.help-content .bg-light {
    border-left: 3px solid #0d6efd;
}

/* Enhanced Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    color: #495057;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.empty-state p {
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* === ADD APPLICATION CARD === */
.add-card {
    border: 2px dashed #ced4da;
    background: #f8f9fa;
    justify-content: center;
    align-items: center;
    transition: all 0.15s ease-in-out;
}

.add-card:hover {
    border-color: #adb5bd;
    background: #fff;
    transform: none;
    box-shadow: none;
    border-left-color: #adb5bd;
}

.add-form {
    width: 100%;
    margin: 0;
}

.add-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.add-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background: #fff;
    font-size: 0.9rem;
}

.add-select:focus {
    border-color: #6c757d;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.25);
}

/* === EMPTY STATE WITH ADD === */
.empty-with-add {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.empty-add-form {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 0.5rem;
    border: 2px dashed #ced4da;
    text-align: center;
}

.inline-add-form {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    max-width: 400px;
    margin: 0 auto;
}

.inline-add-form .form-select {
    flex: 1;
}

.inline-add-form .btn {
    white-space: nowrap;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .add-content {
        gap: 0.5rem;
    }
    
    .inline-add-form {
        flex-direction: column;
        max-width: 100%;
    }
    
    .inline-add-form .form-select,
    .inline-add-form .btn {
        width: 100%;
    }
}
.empty-state-inline {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 0.5rem;
    border: 2px dashed #dee2e6;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .action-buttons {
        justify-content: center;
    }
    
    .add-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .app-grid {
        grid-template-columns: 1fr;
    }
}

/* === BREADCRUMB STYLES === */
.breadcrumb {
    background-color: transparent;
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: #6c757d;
}

.breadcrumb-item.active {
    color: #495057;
    font-weight: 500;
}

.breadcrumb a {
    color: #0d6efd;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

/* === CARD STYLES === */
.info-card {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

.info-card .card-body {
    padding: 1.5rem;
}

/* === BUTTON STYLES === */
.btn-outline-primary {
    color: #6c757d;
    border-color: #ced4da;
    background-color: transparent;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: #495057;
    background-color: #f8f9fa;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.btn-outline-info {
    color: #6c757d;
    border-color: #ced4da;
    background-color: transparent;
}

.btn-outline-info:hover,
.btn-outline-info:focus {
    color: #495057;
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.btn-outline-secondary {
    color: #6c757d;
    border-color: #ced4da;
    background-color: transparent;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    color: #495057;
    background-color: #f8f9fa;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
    background-color: transparent;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.25rem rgba(220, 53, 69, 0.25);
}

.btn-primary {
    background-color: #495057;
    border-color: #495057;
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #343a40;
    border-color: #343a40;
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.15);
}

.btn-success {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

.btn-success:hover,
.btn-success:focus {
    background-color: #5a6268;
    border-color: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.15);
}

.btn-group .btn {
    min-width: 100px;
}

/* === TABLE STYLES === */
.data-table {
    margin-top: 1.5rem;
}

.data-table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    color: #495057;
    padding: 1rem 0.75rem;
}

.data-table td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

.clickable-row {
    cursor: pointer;
    transition: all 0.05s ease-in-out;
    border-left: 3px solid transparent;
}

.clickable-row:hover {
    background-color: #f8f9fa;
    border-left-color: #6c757d;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateX(2px);
}

.clickable-row:active {
    background-color: #e9ecef;
    transform: translateX(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* === FORM STYLES === */
.form-section {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid #e9ecef;
    margin-bottom: 1.5rem;
}

.form-section h3 {
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1.25rem;
    font-weight: 600;
}

.form-inline-group {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.form-inline-group .form-group {
    min-width: 200px;
    flex: 1;
}

/* === ALERT STYLES === */
.alert {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.alert i {
    margin-right: 0.5rem;
}

/* === DANGER ZONE STYLES === */
.danger-zone {
    border: 2px solid #dc3545;
    border-radius: 0.5rem;
    background-color: #fff;
}

.danger-zone .card-header {
    background-color: #dc3545;
    color: white;
    font-weight: 600;
    border-bottom: none;
}

.danger-zone .card-body {
    padding: 1.5rem;
}

/* === UTILITY CLASSES === */
.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.section-title:first-of-type {
    margin-top: 1.5rem;
}

.text-muted-light {
    color: #6c757d !important;
}

.border-start-primary {
    border-left: 4px solid #0d6efd;
    padding-left: 1rem;
}

.border-start-success {
    border-left: 4px solid #198754;
    padding-left: 1rem;
}

.border-start-warning {
    border-left: 4px solid #ffc107;
    padding-left: 1rem;
}

.border-start-danger {
    border-left: 4px solid #dc3545;
    padding-left: 1rem;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .page-header .btn-group {
        width: 100%;
        justify-content: center;
    }
    
    .form-inline-group {
        flex-direction: column;
    }
    
    .form-inline-group .form-group {
        min-width: 100%;
    }
}

/* === ANIMATION STYLES === */
.btn {
    transition: all 0.2s ease-in-out;
}

.card {
    transition: box-shadow 0.2s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

/* === LOADING STATES === */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}