/*
=================================================================
Tailwindish Modern CSS - Enhanced from base template
Author: Gemini (Modified)
Description: More utility-friendly and Tailwind-inspired CSS
=================================================================
*/

/* --- 1. Variables & Global Resets --- */
:root {
    --primary-color: #3b82f6;
    --primary-hover-color: #2563eb;
    --secondary-color: #6b7280;
    --background-color: #f9fafb;
    --surface-color: #ffffff;
    --text-color: #111827;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --border-radius: 0.5rem;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.2s ease-in-out;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- 2. Typography --- */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}
a:hover {
    color: var(--primary-hover-color);
    text-decoration: underline;
}

img, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

hr {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 2rem 0;
}

/* --- 3. Layout --- */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* --- 4. Header & Navigation --- */
.main-header {
    background-color: var(--surface-color);
    box-shadow: var(--box-shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.main-nav a:not(.btn) {
    font-weight: 500;
    color: var(--secondary-color);
    padding: 0.5rem;
    text-decoration: none;
}
.main-nav a:not(.btn):hover,
.main-nav a:not(.btn).active {
    color: var(--primary-color);
    text-decoration: none;
}

.username {
    font-weight: 600;
    color: var(--text-color);
}

/* --- 5. Grid Layout --- */
.widget-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(3, 1fr);
}
@media (min-width: 1024px) {
    .widget-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (max-width: 768px) {
    .widget-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .widget-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    position: relative;
}

/* Scoped styles only for cards inside the widget grid */
.widget-grid .card {
    min-height: 200px;
    max-height: 300px;
    overflow: hidden;
}

.card-title {
    margin-top: 0;
    color: var(--primary-color);
}
.card-content {
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 100px;
    line-height: 1.5em;
    position: relative;
}
.card .overlay-link {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--transition-speed);
}
.card .overlay-link:hover {
    background-color: var(--primary-hover-color);
}

/* --- 6. Forms --- */
.form-group { margin-bottom: 1.5rem; }
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* --- 7. Buttons --- */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed);
    user-select: none;
}
.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-hover-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.btn-secondary {
    background-color: var(--secondary-color);
    color: #fff;
}
.btn-secondary:hover {
    background-color: #4b5563;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* --- 8. Footer --- */
.main-footer {
    background-color: #1f2937;
    color: rgba(255, 255, 255, 0.7);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}
.main-footer a {
    color: #fff;
}
.main-footer a:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* --- 9. Utility Classes --- */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.font-light { font-weight: 300; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.text-gray-500 { color: #6b7280; }
.text-gray-900 { color: #111827; }

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.shadow { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.shadow-md { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1); }

/* --- 10. Media Queries --- */
@media (max-width: 768px) {
    html { font-size: 15px; }
    .container { width: 95%; }
    .main-header .container {
        flex-direction: column;
        gap: 1rem;
    }
    .main-nav ul {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
}