/* Mobile-First Base Styles */
@import './variables.css';

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px; /* Base font size for rem calculations */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    overflow-x: hidden;
}

/* Typography - Mobile-optimized */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-2);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4, h5, h6 { font-size: var(--text-base); }

p {
    margin-bottom: var(--space-4);
    line-height: var(--leading-normal);
}

/* Links */
a {
    color: var(--primary-500);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover, a:focus {
    color: var(--primary-600);
    outline: none;
}

/* Lists */
ul, ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
}

li {
    margin-bottom: var(--space-1);
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Form elements - Mobile-optimized */
input, 
button, 
select, 
textarea {
    font-family: inherit;
    font-size: var(--text-base);
    line-height: var(--leading-normal);
}

input, 
select, 
textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}

input:focus, 
select:focus, 
textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

/* Buttons - Touch-friendly */
button {
    min-height: var(--touch-target);
    padding: var(--space-3) var(--space-6);
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary-500);
    color: var(--text-inverse);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
    touch-action: manipulation;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Tables - Mobile-responsive */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--space-6);
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th, td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

th {
    background-color: var(--bg-secondary);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

/* Responsive utilities */
.show-mobile { display: block; }
.hide-mobile { display: none; }

/* Tablet and up (768px+) */
@media (min-width: 768px) {
    html { font-size: 18px; }
    
    h1 { font-size: var(--text-3xl); }
    h2 { font-size: var(--text-2xl); }
    
    th, td {
        padding: var(--space-4) var(--space-6);
    }
    
    .show-mobile { display: none; }
    .hide-mobile { display: block; }
}

/* Desktop and up (1024px+) */
@media (min-width: 1024px) {
    body {
        background-color: var(--bg-secondary);
    }
}