@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border-color: #e5e7eb;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

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

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

/* Minimalist Grid & Card */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.card {
    background: #fff;
    border: 1px solid #f3f4f6;
    /* Very subtle border */
    border-radius: 8px;
    /* Slightly squarer */
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
    overflow: hidden;
}

.card:hover {
    border-color: #e5e7eb;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    /* Extremely subtle lift */
    transform: translateY(-1px);
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    /* Thinner */
    background: var(--accent);
    width: 100%;
    transform-origin: left;
    transition: transform 1s linear, background-color 0.3s;
    opacity: 0.6;
    /* More transparent */
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.issuer {
    font-size: 0.7rem;
    color: #9ca3af;
    /* Lighter grey */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.account-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.code-display {
    font-size: 1.5rem;
    font-family: 'Courier New', Courier, monospace;
    /* Classic mono */
    font-weight: 400;
    /* Regular weight, not bold */
    color: #111827;
    letter-spacing: 0.1em;
    line-height: 1;
}

/* Actions */
.card-actions {
    display: flex;
    flex-direction: row;
    /* Horizontal actions */
    gap: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
    background: #fff;
    padding-left: 0.5rem;
}

.card:hover .card-actions {
    opacity: 1;
}

.action-btn {
    color: #d1d5db;
    /* Very light default */
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.action-btn:hover {
    color: var(--accent);
}

.action-btn.delete:hover {
    color: var(--danger);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
}

.copy-icon {
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.copy-icon:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

/* Forms */
.form-container {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

input[type="text"],
input[type="password"],
input[type="file"] {
    width: 100%;
    padding: 0.625rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.tab {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

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

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
    padding-top: 0.5rem;
}

.tab-content.active {
    display: block;
}

#reader {
    width: 100%;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #111827;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
    transform: translateY(150%);
    transition: transform 0.2s ease-out;
    z-index: 50;
}

.toast.show {
    transform: translateY(0);
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    body {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }

    /* Wrap the top bar controls */
    .controls>div:first-child {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    #searchBox {
        width: 100%;
        max-width: none !important;
        order: -1;
        /* Move search to top */
        margin-bottom: 0.5rem;
    }

    .btn {
        flex: 1;
        justify-content: center;
        text-align: center;
    }

    /* User greeting section */
    .controls>div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    .grid {
        grid-template-columns: 1fr;
        /* 1 column on mobile */
    }

    .card {
        padding: 1rem;
    }

    /* Make actions always visible on mobile since there's no hover */
    .card-actions {
        opacity: 1;
        background: transparent;
    }

    .action-btn {
        color: #9ca3af;
        /* Make icons visible by default on mobile */
        padding: 0.75rem;
        /* Larger touch target */
    }
}