/* ============================================
   Common CSS Variables & Utilities
   ============================================ */

/* CSS Variables - Color Palette */
:root {
    /* Primary Colors */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-dark: #1e40af;
    
    /* Text Colors */
    --color-text-primary: #111827;
    --color-text-secondary: #374151;
    --color-text-tertiary: #6b7280;
    --color-text-muted: #9ca3af;
    
    /* Background Colors */
    --color-bg-white: #ffffff;
    --color-bg-gray-50: #f9fafb;
    --color-bg-gray-100: #f3f4f6;
    --color-bg-gray-200: #e5e7eb;
    
    /* Border Colors */
    --color-border-gray: #d1d5db;
    --color-border-light: #e5e7eb;
    
    /* Status Colors */
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;
}

/* ============================================
   Layout Foundations
   ============================================ */
html,
body {
    height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-gray-50, #f9fafb);
    color: var(--color-text-primary, #111827);
}

.main-layout {
    flex: 1;
    display: flex;
    min-height: 0;
    width: 100%;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    background: var(--color-bg-gray-50, #f9fafb);
}

/* ============================================
   Common Scrollbar Styles
   ============================================ */

/* Default Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Thin Scrollbar Variant */
.scrollbar-thin::-webkit-scrollbar,
.scrollbar-thin *::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scrollbar-thin::-webkit-scrollbar-thumb,
.scrollbar-thin *::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover,
.scrollbar-thin *::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ============================================
   HelixOps Branding - Gradient & Animation
   ============================================ */

.helixops-gradient {
    background: linear-gradient(to right, #60a5fa, #22d3ee, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: wave 3s ease-in-out infinite;
    display: inline-block;
}

@keyframes wave {
    0%, 100% {
        background-position: 0%;
    }
    50% {
        background-position: 100%;
    }
}

/* ============================================
   Common Button Styles
   ============================================ */

/* Primary Button */
.btn-primary,
.btn-create,
.btn-search {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn-primary:hover,
.btn-create:hover,
.btn-search:hover {
    background: var(--color-primary-hover);
}

.btn-primary:active,
.btn-create:active,
.btn-search:active {
    transform: scale(0.98);
}

.btn-primary:disabled,
.btn-create:disabled,
.btn-search:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Secondary Button */
.btn-secondary,
.btn-reset {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: white;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-gray);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-secondary:hover,
.btn-reset:hover {
    background: var(--color-bg-gray-100);
    color: var(--color-text-primary);
    border-color: var(--color-border-gray);
}

.btn-secondary:active,
.btn-reset:active {
    transform: scale(0.98);
}

.btn-secondary:disabled,
.btn-reset:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Button Sizes */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ============================================
   Common Input Styles
   ============================================ */

.input-base {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border-gray);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--color-text-primary);
    background: white;
}

.input-base:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-base::placeholder {
    color: var(--color-text-muted);
}

.input-base:disabled {
    background: var(--color-bg-gray-100);
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   Common Utility Classes
   ============================================ */

/* Text Colors */
.text-primary {
    color: var(--color-text-primary);
}

.text-secondary {
    color: var(--color-text-secondary);
}

.text-tertiary {
    color: var(--color-text-tertiary);
}

.text-muted {
    color: var(--color-text-muted);
}

.text-blue {
    color: var(--color-primary);
}

/* Background Colors */
.bg-white {
    background-color: var(--color-bg-white);
}

.bg-gray-50 {
    background-color: var(--color-bg-gray-50);
}

.bg-gray-100 {
    background-color: var(--color-bg-gray-100);
}

/* Border Colors */
.border-gray {
    border-color: var(--color-border-gray);
}

.border-light {
    border-color: var(--color-border-light);
}

/* Spacing Utilities */
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

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

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

/* Display Utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

/* ============================================
   Common Modal Styles
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-overlay.closing {
    opacity: 0;
}

.modal-container {
    background: var(--color-bg-white);
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s;
    overflow: hidden;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px 15px 24px;
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.modal-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-tertiary);
    margin: 0.25rem 0 0 0;
}

/* Modal sizes */
.modal-small {
    max-width: 24rem;
}

.modal-medium {
    max-width: 32rem;
}

.modal-large {
    max-width: 48rem;
}

.modal-xlarge {
    max-width: 64rem;
}

.modal-close-btn {
    padding: 0.5rem;
    background: none;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--color-text-tertiary);
    transition: background-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

.modal-close-btn:hover {
    background: var(--color-bg-gray-100);
    color: var(--color-text-primary);
}

.modal-close-btn i {
    font-size: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Modal body uses common scrollbar styles */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--color-border-gray);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.modal-footer {
    padding: 15px 24px;
    border-top: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
}

.modal-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.modal-btn-primary:hover {
    background: var(--color-primary-hover);
}

.modal-btn-secondary {
    background: var(--color-bg-gray-100);
    color: var(--color-text-secondary);
}

.modal-btn-secondary:hover {
    background: var(--color-bg-gray-200);
}

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

/* Modal Responsive */
@media (max-width: 768px) {
    .modal-container {
        max-width: 95vw;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

/* ============================================
   Common Form Elements in Modals
   ============================================ */

.modal-description {
    font-size: 0.875rem;
    color: var(--color-text-tertiary);
    margin: 0.25rem 0 0 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-border-gray);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--color-text-primary);
    background: var(--color-bg-white);
}

.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
    outline: none;
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

/* ============================================
   Common Dropdown Styles
   ============================================ */

.dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-bg-gray-100);
}

.dropdown-header h3 {
    color: var(--color-text-primary);
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.dropdown-header p {
    font-size: 0.875rem;
    color: var(--color-text-tertiary);
    margin: 0;
}

.dropdown-content {
    max-height: 24rem;
    overflow-y: auto;
}

/* Dropdown content uses common scrollbar styles */
.dropdown-content::-webkit-scrollbar {
    width: 6px;
}

.dropdown-content::-webkit-scrollbar-track {
    background: transparent;
}

.dropdown-content::-webkit-scrollbar-thumb {
    background: var(--color-border-gray);
    border-radius: 3px;
}

.dropdown-content::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.dropdown-item {
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: left;
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background: var(--color-bg-gray-50);
}

.dropdown-item.logout {
    color: var(--color-error);
}

.dropdown-item.logout:hover {
    background: #fee2e2; /* red-100 - keep specific color for logout */
}

.dropdown-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--color-bg-gray-100);
    text-align: center;
}

/* ============================================
   SweetAlert2 Custom Styles
   ============================================ */

div:where(.swal2-icon) {
    width: 5em;
    height: 5em;
}

div:where(.swal2-container) {
    z-index: 12000 !important;
}

div:where(.swal2-icon) .swal2-icon-content {
    font-size: 2.75em;
}

div:where(.swal2-container) h2:where(.swal2-title) {
    font-size: 1.5em;
    padding-top: 10px;
}

div:where(.swal2-container) div:where(.swal2-html-container) {
    padding-top: 10px;
    font-size: 16px;
    color: #777;
}

/* ============================================
   Notyf Toast Styles - Ensure visibility
   ============================================ */

.notyf {
    z-index: 9999 !important;
}

.notyf__toast {
    z-index: 9999 !important;
    max-width: 330px !important;  /* 최대 가로 크기 */
    min-width: 300px !important;  /* 최소 가로 크기 (선택사항) */
}

.notyf__notification {
    max-width: 330px !important;  /* 배경색이 적용되는 요소의 최대 크기 */
    width: 100% !important;       /* 부모 요소의 100% 너비 사용 */
    overflow: visible !important;
}

.notyf__message {
    overflow: visible !important;
    word-wrap: break-word !important;
    white-space: normal !important;  /* 긴 텍스트 줄바꿈 */
}
