/* ===============================
   UTILITIES & RESPONSIVE HELPERS
=============================== */

/* SPACING UTILITIES */
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.px-1 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2 { padding-left: 1rem; padding-right: 1rem; }
.px-3 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-4 { padding-left: 2rem; padding-right: 2rem; }

.py-1 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2 { padding-top: 1rem; padding-bottom: 1rem; }
.py-3 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-4 { padding-top: 2rem; padding-bottom: 2rem; }

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

.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }

/* DISPLAY UTILITIES */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-around { display: flex; align-items: center; justify-content: space-around; }

.grid { display: grid; }

.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

.hidden { display: none !important; }
.visible { display: block !important; }

.invisible { visibility: hidden; }

/* TEXT UTILITIES */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* COLOR UTILITIES */
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.text-accent { color: var(--accent-color); }
.text-muted { color: var(--text-secondary); }

.bg-primary { background-color: var(--primary-color); }
.bg-secondary { background-color: var(--secondary-color); }
.bg-card { background-color: var(--card-bg); }

/* BORDER UTILITIES */
.border { border: 1px solid var(--border-color); }
.border-none { border: none; }
.border-top { border-top: 1px solid var(--border-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }

.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 16px; }
.rounded-full { border-radius: 9999px; }

/* SHADOW UTILITIES */
.shadow-sm { box-shadow: 0 1px 2px var(--shadow-color); }
.shadow { box-shadow: 0 4px 6px var(--shadow-color); }
.shadow-lg { box-shadow: 0 10px 15px var(--shadow-color); }
.shadow-xl { box-shadow: 0 20px 25px var(--shadow-color); }
.shadow-glow { box-shadow: 0 0 20px var(--shadow-glow); }

/* OPACITY UTILITIES */
.opacity-0 { opacity: 0; }
.opacity-25 { opacity: 0.25; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* POSITIONING UTILITIES */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

/* SIZE UTILITIES */
.w-full { width: 100%; }
.h-full { height: 100%; }
.w-screen { width: 100vw; }
.h-screen { height: 100vh; }

.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-full { max-width: 100%; }

/* GAPS */
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/* RESPONSIVE DISPLAY */
@media (max-width: 768px) {
    .hidden-mobile { display: none !important; }
    .visible-mobile { display: block !important; }
    .hidden-tablet { display: block !important; }
}

@media (min-width: 769px) {
    .hidden-desktop { display: none !important; }
    .visible-desktop { display: block !important; }
    .hidden-tablet { display: none !important; }
}

@media (max-width: 480px) {
    .hidden-phone { display: none !important; }
    .visible-phone { display: block !important; }
}

/* RESPONSIVE PADDING */
@media (max-width: 1024px) {
    .p-responsive-xl { padding: 1.5rem; }
    .px-responsive-xl { padding-left: 1.5rem; padding-right: 1.5rem; }
    .py-responsive-xl { padding-top: 2.5rem; padding-bottom: 2.5rem; }
}

@media (max-width: 768px) {
    .p-responsive { padding: 1rem; }
    .px-responsive { padding-left: 1rem; padding-right: 1rem; }
    .py-responsive { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    
    .p-responsive-xl { padding: 1rem; }
    .px-responsive-xl { padding-left: 1rem; padding-right: 1rem; }
    .py-responsive-xl { padding-top: 1.5rem; padding-bottom: 1.5rem; }
}

@media (max-width: 480px) {
    .p-responsive { padding: 0.75rem; }
    .px-responsive { padding-left: 0.75rem; padding-right: 0.75rem; }
    .py-responsive { padding-top: 1rem; padding-bottom: 1rem; }
    
    .p-responsive-lg { padding: 0.75rem; }
    .px-responsive-lg { padding-left: 0.75rem; padding-right: 0.75rem; }
    .py-responsive-lg { padding-top: 1rem; padding-bottom: 1rem; }
}

/* RESPONSIVE MARGIN */
@media (max-width: 768px) {
    .m-responsive { margin: 1rem; }
    .mx-responsive { margin-left: 1rem; margin-right: 1rem; }
    .my-responsive { margin-top: 1rem; margin-bottom: 1rem; }
}

@media (max-width: 480px) {
    .m-responsive { margin: 0.75rem; }
    .mx-responsive { margin-left: 0.75rem; margin-right: 0.75rem; }
    .my-responsive { margin-top: 0.75rem; margin-bottom: 0.75rem; }
}

/* RESPONSIVE FONT SIZE */
@media (max-width: 768px) {
    .text-responsive-xl { font-size: 1.5rem; }
    .text-responsive-lg { font-size: 1.25rem; }
    .text-responsive-md { font-size: 1.1rem; }
    .text-responsive-sm { font-size: 0.95rem; }
}

@media (max-width: 480px) {
    .text-responsive-xl { font-size: 1.25rem; }
    .text-responsive-lg { font-size: 1.1rem; }
    .text-responsive-md { font-size: 0.95rem; }
    .text-responsive-sm { font-size: 0.85rem; }
}

/* FLEX RESPONSIVE */
@media (max-width: 768px) {
    .flex-mobile-col { flex-direction: column; }
    .gap-mobile-1 { gap: 0.5rem; }
    .gap-mobile-2 { gap: 1rem; }
    .gap-mobile-3 { gap: 1.5rem; }
}

@media (max-width: 480px) {
    .flex-col-mobile { flex-direction: column !important; }
    .gap-compact { gap: 0.5rem; }
}

/* GRID RESPONSIVE */
@media (max-width: 768px) {
    .grid-mobile-1 { grid-template-columns: 1fr; }
    .grid-mobile-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .grid-mobile-1 { grid-template-columns: 1fr !important; }
}

/* HEIGHT RESPONSIVE */
@media (max-width: 768px) {
    .h-responsive { height: auto; }
    .min-h-responsive { min-height: auto; }
}

/* WIDTH RESPONSIVE */
@media (max-width: 768px) {
    .w-responsive { width: 100%; }
    .max-w-responsive { max-width: 100%; }
}

@media (max-width: 480px) {
    .w-mobile-full { width: 100%; }
}

/* CONTAINER RESPONSIVE */
@media (max-width: 1024px) {
    .container-xl { max-width: 100%; padding: 0 1.5rem; }
}

@media (max-width: 768px) {
    .container { max-width: 100%; padding: 0 1rem; }
    .container-lg { max-width: 100%; padding: 0 1rem; }
    .container-xl { max-width: 100%; padding: 0 1rem; }
}

@media (max-width: 480px) {
    .container { max-width: 100%; padding: 0 0.75rem; }
    .container-lg { max-width: 100%; padding: 0 0.75rem; }
}

/* TOUCH-FRIENDLY BUTTONS */
@media (max-width: 768px) {
    .btn-touch {
        min-height: 44px;
        min-width: 44px;
    }
}

/* RESPONSIVE IMAGES */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 768px) {
    .img-mobile-hide { display: none; }
    .img-mobile-show { display: block; }
}

/* TEXT TRUNCATE RESPONSIVE */
@media (max-width: 768px) {
    .truncate-mobile { 
        overflow: hidden; 
        text-overflow: ellipsis; 
        white-space: nowrap; 
    }
}

/* SPACING SCALE */
@media (max-width: 480px) {
    .space-scale { transform: scale(0.95); }
}

/* ACCESSIBILITY */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* CURSOR UTILITIES */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; opacity: 0.5; }

/* POINTER EVENTS */
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

/* USER SELECT */
.user-select-none { user-select: none; }
.user-select-text { user-select: text; }

/* OVERFLOW */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* WHITESPACE */
.whitespace-normal { white-space: normal; }
.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre { white-space: pre; }
.whitespace-pre-wrap { white-space: pre-wrap; }

/* SCROLL BEHAVIOR */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
